2013-10-27 67 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%;