gpt4 book ai didi

html - Div元素不会在CSS中换行

转载 作者:行者123 更新时间:2023-12-01 22:38:19 24 4
gpt4 key购买 nike

ID=content 的 Div 标签不会换行。它会像这样进入标题行。 enter image description here

谁能解释一下为什么会这样?? ,以及如何将其放入新行?

<html>

<head>
<title> Home Page </title>

<style>

#wrapper
{
width:70%;
margin: 0 auto;
}

#header .Nav
{
width:60%;
float:right;
}

#header .Nav ul a
{
margin: 0 3%;
float:right;
text-decoration:none;
}

#header .logo
{
width=40%;
float:left;
}

.title
{
float:left;
width:30%;
}

.main_content
{
float:right;
width:70%;
}


</style>


</head>

<body>

<div id="wrapper" >

<div id="header">

<a href="/" class="logo"><img src="./logo.gif" alt="Zach Woomer" /></a>

<div class="Nav">


<ul>

<a href="./contact.htm">Home</a>
<a href="./contact.htm">About US</a>
<a href="./contact.htm">Products</a>
<a href="./contact.htm">Contact US</a>
</ul>

</div>

</div>

<div id="content">

<div class="title" >
<h1>This text wraps on the left side and side and side and side </h1>
</div>

<div class="main_content">

</div>

</div>


</div>

</body>

</html>

最佳答案

尝试将此代码添加到您的内联样式标记中,使内容 div 显示在其自己的行中:

#content {
clear: both;
}

您的 css 中还有一个 width=40%,所以您也应该修复它。

关于html - Div元素不会在CSS中换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19621902/

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