gpt4 book ai didi

css - 为什么清除:both?时出现白线

转载 作者:太空宇宙 更新时间:2023-11-03 22:07:07 25 4
gpt4 key购买 nike

我试图让 h1 出现在左侧,h2 出现在右侧,这要归功于之前关于 stackoverflow 的帖子。但是现在文本下方出现了一条白线,严重扰乱了我的设计。有什么想法吗?

<div id="container">
<div id="header">
<h1 style="text-align:left;float:left;">Ken DeRosier</h1>
<h2 style="text-align:right;float:right;">Master Sculptor</h2>
<hr style="clear:both;">
<!-- end #header -->
</div>
...
</div>

这是我能想到的所有可能影响上述代码的 CSS。

body  {
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #FFFFbb;
font-family: Arial, Helvetica, sans-serif;
font-size: 100%;
background-color: #000000;
background-repeat: no-repeat;
background-position: center top;
background-image: url(../images/sunriseHeader.jpg);
}
.thrColLiqHdr #container {
width: 80%; /* this will create a container 80% of the browser width */
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 0px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.thrColLiqHdr #header {
padding: 0 10px;
padding-top: 170px;
padding-right: 20px;
}
.thrColLiqHdr #header h1 {
margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */

最佳答案

尝试替换这一行

<hr style="clear:both;">

有了这个

<div style="clear:both;"></div>

关于css - 为什么清除:both?时出现白线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5013297/

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