2013-10-22 19 views
-2

好吧,這裏是我的問題,我有一個網站,在中間我有一個部分和一邊。網頁上的所有其他內容都是100%,但是該部分和旁邊我希望等於80%,並且我在中間彼此相鄰。但是我得到了這個。我的div不會去中間

IMAGE:https://twitter.com/iamalecgrogan/status/392454057345810432/photo/1

你開始說的東西之前,我曾嘗試每一件事情做表單元格和表格verticaly對齊和在線塊elemets創建一個div爲他們進入。但沒有任何工作,請幫助。這是我的代碼。

<!DOCTYPE html> 

<html lang="en"> 

<head> 

<meta charset="UTF-8"> 
<title> 
Home | ProvideWebDesign 
</title> 
<link rel="stylesheet" type="text/css" href="styles/layout.css"> 
<link rel="stylesheet" type="text/css" href="styles/style.css"> 

</head> 

<body> 

<div id="wrapper"> 

<header id="header"> 

<div id="header_right"> 
</div> 

<div id="header_left"> 
</div> 

</header> 

<nav id="nav"> 
</nav> 

<section id="section"> 

<article id="section_article"> 
</article> 

<article id="section_article2"> 
</article> 

</section> 

<aside id="aside"> 

<article id="aside_article"> 
</article> 

<article id="aside_article2"> 
</article> 

<article id="aside_article3"> 
</article> 

</aside> 

<footer id="footer"> 

<div id="footer_right"> 
</div> 

<div id="footer_left"> 
</div> 

</footer> 

</div> 

</body> 

</html> 

CSS-------------------- 

* 
{ 
margin: 0px; 
padding: 0px; 
} 

#wrapper 
{ 
width: 100%; 
height: 875px; 
display: table; 
} 

#header 
{ 
width: 100%; 
height: 75px; 
display: block; 
} 

#header_right 
{ 
width: 50%; 
height: 75px; 
float: left; 
display: block; 
} 

#header_left 
{ 
width: 50%; 
height: 75px; 
float: left; 
display: block; 
} 

#nav 
{ 
width: 100%; 
height: 50px; 
display: block; 
} 

#section 
{ 
    width: 60%; 
height: 600px; 
float: left; 
display: table-cell; 
} 
#aside 
{ 
width: 20%; 
height: 600px; 
float: left; 
display: table-cell; 
} 

#footer 
{ 
width: 100%; 
height: 150px; 
display: block; 
clear: both; 
} 

#footer_right 
{ 
width: 50%; 
height: 150px; 
float: left; 
display; block; 
} 

#footer_left 
{ 
width: 50%; 
height: 150px; 
float: left; 
display: block; 
} 
+0

你忘了發佈的CSS樣式。請創建一個[jsfiddle](http://jsfiddle.net/)。 – Gigo

+0

什麼?我是新來堆棧流 –

+1

好吧,我們需要layout.css和style.css的內容。 – Gigo

回答

1

創建一個包含元素,例如圍繞該部分的div,併爲該容器設置80%的寬度,塊顯示和邊距自動。丟失部分和旁邊的表格單元格顯示。給容器一個明確的修復:https://gist.github.com/jelmerdemaat/3804403

+0

什麼是從未聽說過的明確修復? –

+0

@Alec Robert Grogan我添加了一個鏈接。 –

+0

是否有任何東西我需要改變,如在cs.before和之後的名稱,像是有我更改的任何名稱,並非常感謝您的幫助。 –