2013-10-27 64 views
0

ID = content的div标签不会换行。它会像这样进入标题行。 enter image description herediv元素不会在css中换行

任何人都可以请解释为什么会发生这种情况? ,以及如何把它放在新的路线?

<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> 
+1

那么,你有一些不正确的CSS'width = 40%'而不是'width:40%'。这可能是问题 – putvande

+1

JSFiddle请 –

+2

这也是我的理解,唯一的事情,可以是直接的儿童'ul' /'ol'是'li'。 –

回答

3

尝试将此代码添加到您的内嵌样式代码,从而使内容股利出现在自己的行:

#content { 
    clear: both; 
} 

你也有你的CSS width=40%,所以你应该修复,以及。

+0

改变到宽度:40%工作..这是一个错字错误..非常感谢:) – abhinav

+0

如何获得那些无序的列表项目联系我们,产品等..在同一个水平上? – abhinav

1

FIDDLE

我有固定您的问题兄弟,我希望你能达到与东西。

width: 30%;min-width: 30%;