gpt4 book ai didi

HTML/CSS 标题格式问题

转载 作者:行者123 更新时间:2023-11-28 02:06:10 24 4
gpt4 key购买 nike

我正在开展一个元素,其中包括创建网络应用程序。目前,我专注于网站的总体设计和布局。首先,我想要在顶部有一个水平的深灰色标题。在其下方,我想要两列,一列带有导航栏,一列包含内容。

Actual result

Desired result

下面是我的代码,我不确定是什么导致顶部的黑色标题没有显示。

完整的 CSS 文件:https://pastebin.com/kpUHV71Z

<section class="management">
<div class="header-div">
<img src="Golf.png" class="management-logo" height="50" width="50">
<h1 class="impact" id="management-header">Management Dashboard</h1>
</div>
<div class="left left-nav">
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</div>
<div class="right">
<h3>Staff</h3>
</div>
<div class="clear"></div>
</section>

最佳答案

您需要为标题分配显示和宽度

.header-div {
background-color: #555555;
border-radius: 5px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
height: auto;
width: 100%;
display: inline-block;
}

这将使标题表现为一个 block 并让您调整导航

希望这就是您要找的。如果需要,很乐意解释或提供更好的解决方案。

body {
text-align: center;
background-image: url("background.jpg");
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
font-family: verdana;
}

.selection-menu {
margin-top: 50px;
}

#special-button {
margin-top: 100px;
margin-left: 200px;
}
#special-button2 {
margin-top: 100px;
margin-left: 400px;
}

#header {
margin-top: 10px;
font-weight: bold;
font-size: 60px;
color: white;
}

#author {
font-weight: normal;
font-size: 25px;
margin-top: -40px;
color: white;
padding-bottom: 20px;
}

.club-selection {
font-weight: bold;
margin-top: 20px;
font-size: 50px;
}

.input-header {
font-weight: bold;
margin-top: 20px;
font-size: 50px;
}

.impact {
font-family: Montserrat;
}

.index-section {
background-color: rgb(242,242,242);
border-radius: 5px;
width: 50%;
margin: auto;
padding-bottom: 25px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin-top: 50px;
}

table {
border-collapse: collapse;
margin: auto;
margin-top: 10px;
}

table td, table th {
border: 1px solid lightgrey;
padding: 2px;
}

.management {
background-color: rgb(242,242,242);
border-radius: 5px;
width: 90%;
margin: auto;
padding-bottom: 25px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin-top: 50px;
}

h3 {
font-size: 40px;
font-family: Montserrat;
margin-bottom: 10px;
}

.separate {
width: 95%;
margin: auto;
margin-top: 20px;
margin-bottom: -30px;
}

.buttongroup {
display: inline;
}

input {
display: inline;
}

button {
background-color: #555555;
border: none;
color: white;
padding: 7px 16px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
border-radius: 5px;
}

button:hover {
background-color: lightgrey;
color: black;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

input {
border: none;
height: 3%;
}

#appdescription {
margin-top: 40px;
margin-bottom: -10px;
}

.inline-alignment {
display: inline;
margin-bottom: 20px;
}

img {
margin-left: 20px;
}

.header-div {
background-color: #555555;
border-radius: 5px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
height: auto;
width: 100%;
display: inline-block;
}

.left {
width: 25%;
float: left;
}

.right {
margin-left: 25%;
}

.clear {
clear: both;
}

.management-logo {
float: left;
clear: right;
margin-right: 20px;
}

#management-header {
margin-top: 10px;
font-weight: bold;
font-size: 30px;
color: white;
float: left;
margin: 0;
}

ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 200px;
background-color: grey;
}

li a {
display: block;
color: #000;
padding: 8px 16px;
text-decoration: none;
}

li a:hover {
background-color: #555;
color: white;
}

.left-nav {
background-color: grey;
}
<section class="management">
<div class="header-div">
<img src="Golf.png" class="management-logo" height="50" width="50">
<h1 class="impact" id="management-header">Management Dashboard</h1>
</div>
<div class="left left-nav">
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</div>
<div class="right">
<h3>Staff</h3>
</div>
<div class="clear"></div>
</section>

关于HTML/CSS 标题格式问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49000295/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com