gpt4 book ai didi

html - 我的导航栏不符合我的 div.container?

转载 作者:行者123 更新时间:2023-11-28 05:16:10 25 4
gpt4 key购买 nike

header {
background-color:black;
color:white;
text-align:center;
padding:5px;
}

nav {
line-height:30px;
background-color:gainsboro;
height:548px;
width:100px;
float:left;
padding:px;
}

body {
background-color:Lavender;
}

article {
float:right;
height:1250px;
width:580px;
text-align:center;
padding:1em;
background-color:#5DADE2;
}

section {
float:left;
height:1320px;
width:600px;
text-align:center;
padding:0em;
background-color:#ECF0F1
}

footer {
background-color:black;
color:white;
clear:both;
text-align:center;
padding:5px;
}

div.container {
width:100%;
border:2px solid purple;
}

.clearfix {
overflow: auto;
}

.clear {
clear:right;
line-height:0;
}
<!DOCTYPE HTML>
<html>

<head>

<title>Links - Bannerlord Assignment</title>

<link rel="stylesheet" type="text/css" a href="BannerlordTheme2.css">

</head>

<div class="container">

<body>

<header>

<h1>Further Information</h1>

</header>

<nav>
<a href="Home.html">Home</a><br>
<a href="About.html">About</a><br>
<a href="Media.html">Media</a><br>


</nav>

</body>

</div>

<br class="clear" />

</html>

请耐心等待我,我知道这是非常基础的,但我需要从某个地方开始,我既找不到答案也找不到原因。

我的导航栏与我的 div 的边框不对应,这不是什么大问题,但我如何获得它,以便在我使用边框时导航栏和标题不重叠,因为现在 div 边框仅在页眉上工作。

最佳答案

您需要将溢出隐藏到容器中。

header {
background-color:black;
color:white;
text-align:center;
padding:5px;
}

nav {
line-height:30px;
background-color:gainsboro;
height:548px;
width:100px;
float:left;
padding:px;
}

body {
background-color:Lavender;
}

article {
float:right;
height:1250px;
width:580px;
text-align:center;
padding:1em;
background-color:#5DADE2;
}

section {
float:left;
height:1320px;
width:600px;
text-align:center;
padding:0em;
background-color:#ECF0F1
}

footer {
background-color:black;
color:white;
clear:both;
text-align:center;
padding:5px;
}

div.container {
width:100%;
border:2px solid purple;
overflow: hidden;
}

.clearfix {
overflow: auto;
}

.clear {
clear:right;
line-height:0;
}
<!DOCTYPE HTML>
<html>

<head>

<title>Links - Bannerlord Assignment</title>

<link rel="stylesheet" type="text/css" a href="BannerlordTheme2.css">

</head>

<div class="container">

<body>

<header>

<h1>Further Information</h1>

</header>

<nav>
<a href="Home.html">Home</a><br>
<a href="About.html">About</a><br>
<a href="Media.html">Media</a><br>


</nav>

</body>

</div>

<br class="clear" />

</html>

关于html - 我的导航栏不符合我的 div.container?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39303291/

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