2

ID=content 的 Div 标签不会换行。它会像这样进入标题行。 在此处输入图像描述

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

<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>
4

2 回答 2

6

尝试将此代码添加到您的内联样式标签中,以使内容 div 出现在自己的行中:

#content {
  clear: both;
}

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

于 2013-10-27T18:45:47.377 回答
1

小提琴

我已经解决了你的问题兄弟,我希望你能解决这个问题。

width: 30%;min-width: 30%;. _

于 2013-10-27T21:19:10.977 回答