gpt4 book ai didi

html - Div 搞砸了 我尝试向其中添加文本?

转载 作者:行者123 更新时间:2023-11-28 06:48:25 27 4
gpt4 key购买 nike

基本上,当我尝试将一个段落添加到 <div> 中的一个时我遇到麻烦了。页面似乎乱七八糟。我的代码有什么问题吗?还有,我的代码有哪些需要改进的地方?

谢谢!

<!DOCTYPE HTML>
<html>
<style>
* {
font-family: georgia;
}
body {
background-color: white;
}
#content {
width: 60%;
height: 1500px;
margin: auto;


}
#header {
height: 200px;
border: 1px dashed;
background-color: #44424D;

}
#left {
width: 20%;
height: 100%;
display: inline-block;
}
#right {
height: 100%;
width: 20%;
display: inline-block;
position: relative;
left: 676px;

}
#name {
font-family: big john;
font-size: 50px;
width: 100%;
margin: 0 auto;
border-bottom: 1px solid;
color: white;
}
.wot {
background-color: #E6C88C;
}
</style>
<head><title>Film Club</title></head>
<body>
<div id="content">
<div id="header">
<h1 id="name">The Film Club</h1>
</div>
<div id="left", class="wot">
<p>Test</p>
</div>
<div id="right", class="wot">
</div>
</div>
</body>
</html>

最佳答案

首先,您的 HTML 中有逗号,这是不正确的。

<div id="content">
<div id="header">
<h1 id="name">The Film Club</h1>
</div>
<div id="left" class="wot">
<p>Test</p>
</div>
<div id="right" class="wot">
</div>
</div>

其次,将带有文本的 div 的高度设置为 100%,将 #content div 的高度设置为 1500px 所以 div 扩展到这个完整的高度。 div 的高度仅在包含内容时应用,这就是当您放入文本时它会发生变化的原因。您可以从 CSS 中删除高度,或将其设置为更合适的值。

关于html - Div 搞砸了 我尝试向其中添加文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33915622/

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