gpt4 book ai didi

html - 如何在 HTML5 中使用 100% DIV 高度?

转载 作者:太空宇宙 更新时间:2023-11-04 00:08:57 24 4
gpt4 key购买 nike

我尝试关注许多文章并在 SO 中使用了许多链接,但我无法修复我页面的 CSS。该页面可以在这里看到:http://tinyurl.com/d3ru8tf

截图:

enter image description here

我的 CSS

html, body {
height:100%
}

body{
line-height:1;
color:#454545;
background:url(/assets/imgs/bg.png);
font:11px Tahoma,Arial,sans-serif
}

#soul{
display:block;
margin:0 auto;
width:920px;
background:url(/assets/imgs/back.png) repeat-y right #fff;
padding:0;
position:relative;
height:100%
}

我的 HMTL5

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="soul">

This is my content which does not sit fluid.

</div>
</body>
</html>

最佳答案

添加<hr style="clear:both;" />关门前</div>#soul并删除 height:100%来自 #soul CSS。

enter image description here

此外,使用 min-height:100% ,或者更好的是,在这种情况下根本不要使用该属性。

编辑

阅读更多关于 float div 的信息:http://css-tricks.com/all-about-floats/

此外,您似乎希望它们的高度相等。

enter image description here

看看这个:http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks

关于html - 如何在 HTML5 中使用 100% DIV 高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13788678/

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