這是我的style.css
基於Blankslate的Wordpress主題(我沒有改變任何PHP,我只是開始CSS)。爲什麼我的div的高度大於身體?
我已經突出顯示了元素的邊框以使它們可見...並且所有內容都溢出了body
邊框。這是全部的CSS:
/* = CSS Reset
-------------------------------------------------- */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{font-size:100%;font:inherit;padding:0;border:0;margin:0;vertical-align:baseline}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}.sticky{}.bypostauthor{}.wp-caption{}.wp-caption-text{}.gallery-caption{}.alignright{}.alignleft{}.aligncenter{}
/* =Highlight
highlight the basic structural elements of the site
-------------------------------------------------- */
body {border: thin solid red;}
#sidebar {border: thin solid blue;}
#content {border: thin solid green;}
/* =Structure
-------------------------------------------------- */
body {
width: 1000px;
float: center;
margin: auto;
}
#sidebar {
width: 300px;
float: right;
}
#content {
width: 500px;
float: left;
}
關於clearfix的更多信息(這是他們所引用的內容):http://www.webtoolkit.info/css-clearfix.html – 2012-07-08 03:11:56
:(元素仍然出現在紅色輪廓之中......我沒有得到它不應該自動調整嗎?沒有我見過的CSS教程暗示我們需要做任何特殊的事情,以防止div出現在我的身體外面,我也嘗試過'clewar:both;'。 – iDontKnowBetter 2012-07-08 03:13:04
@fakaff看到更新後的答案,我認爲這可以在'body'元素上工作,但它不會,並且不會,它不應該自動調整,因爲您期待。浮動「不在流動中」,這意味着它們不會 – bfavaretto 2012-07-08 03:24:21