gpt4 book ai didi

html - body标签不显示(调整大小)可控

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

我只是在测试一些基本的 html 和 css 东西,当我遇到一个我根本无法解决的问题时。

文件:

test2.html:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="test2.css">
</head>
<body class="design1">
<div id="container">
<div id="menu" class="box">
<a href="test2.html#text1" class="box">Abschitt 1</a>
<a href="test2.html#text2" class="box">Abschitt 2</a>
<a href="test2.html#text3" class="box">Abschitt 3</a>
</div>
<div id="main" class="box">
<div id="header" class="box">
<span class="box head">Test2</span>
<span class="box head">Überschrift</span>
<span class="box head">10.09.2012</span>
</div>
<div id="text" class="box">
<p id="text1" class="box">
Lorem ipsum ...
</p>
<p id="text2" class="box">
Lorem ipsum...
</p>
<p id="text3" class="box">
Lorem ipsum...
</p>
</div>
<div id="footer" class="box">
Von ####
</div>
</div>
</div>
</body>
</html>

test2.css:

html, body, div, span {
background: none repeat scroll 0% 0% transparent;
border: 0px none;
font-size: 100%;
margin: 0px;
padding: 0px;
outline: 0px none;
vertical-align: baseline;
}

.box {
background: rgba(0, 0, 67, 0.2);
border-color: rgba(0, 0, 67, 1.0);
border-width: 1px;
border-style: solid;
}

#menu {
position: absolute;
left: 5px;
top: 5px;
width: 200px;
bottom: 5px;
}

#main {
position: absolute;
left: 210px;
top: 5px;
right: 5px;
bottom: 5px;
}

如果我查看带有 Firebug booth 的页面,html 和 body 元素的大小为 0px 乘以 100%(宽度)并且不可见(但是显示了 innerHTML 部分)。但是,如果我删除最后一个样式规范,它们会跳回到它们的正常行为并具有完整页面的大小(100% 乘以 100%)。

删除最后一个规范后的test2.css:

html, body, div, span {
background: none repeat scroll 0% 0% transparent;
border: 0px none;
font-size: 100%;
margin: 0px;
padding: 0px;
outline: 0px none;
vertical-align: baseline;
}

.box {
background: rgba(0, 0, 67, 0.2);
border-color: rgba(0, 0, 67, 1.0);
border-width: 1px;
border-style: solid;
}

#menu {
position: absolute;
left: 5px;
top: 5px;
width: 200px;
bottom: 5px;
}

有谁知道为什么会发生这种情况以及如何避免这种情况?

最佳答案

这应该对您有所帮助: CSS Adjust Parent DIV size if Absolute Child DIV falls outside boundaries虽然我猜你仍然与 <p> 有冲突标签。我猜 min-height可以帮助你。

关于html - body标签不显示(调整大小)可控,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12359852/

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