我並排浮動兩個div。我無法設置左側div的屬性,因爲它們似乎是從正確的div繼承的。我猜我「米只是俯瞰東西在這裏,但我需要什麼做的,所以我他們不能被繼承?CSS浮動div繼承
div.main - content {
width: 1500 px;
}
div.left {
float: left;
width: 300 px;
overflow: hidden;
background - color: #ffffff;
}
table.;
left {
border - collapse: collapse;
width: 300 px;
}
table.left, td {
border: 1 px hidden black;
padding: 5 px;
background - color: #ffffff;
color: #000000;
}
div.right {
float:right;
width:1200px;
overflow:hidden;
}
table.right {
border-collapse:collapse;
width:765px;
}
table.right, th {
border: 1px solid black;
padding:5px;
background-color:# df1e37;
color: #ffffff;
}
table.right, td {
border: 1 px dotted# cccccc;
padding: 5 px;
background - color: #ffffff;
color: #000000;
}
<div class="main-content">
<div class="left">
<table class="left">
<tr>
<td>Left content here</td>
</tr>
</table>
</div>
<div class="right">
<table class=right>
<tr>
<td>Right content here</td>
</tr>
</table>
</div>
</div>
我懷疑這是扔你; 'table.right,td'應該是'table.right td','table.left,td'應該是'table.left td'。假設你希望'td'的風格有所不同 – Turnip 2014-10-20 20:21:09
這是個問題,非常感謝!儘管這是一條評論,但現在一切正在運行,我不能選擇它作爲最佳答案。 – aantiix 2014-10-20 20:26:25
Btw +1代碼示例易於使用:)(SCCS ftw) – Ben 2014-10-20 20:26:45