1
如何在midItem元素周圍有適當的邊框?我如何在中間元素周圍有適當的邊框?
這裏是一樣的小提琴縮小的代碼,
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<style type="text/css">
span,.midItem {
border-style: solid;
}
.midItem {
border-color: blue;
padding: 5px;
}
p {
text-align:justify;
}
.leftPage,.rightPage{
display:inline-block;
width: 33%;
padding: 5px;
}
.centerBox {
display:table-cell;
text-align: center;
vertical-align: middle;
}
.leftBox,.rightBox {
display: table;
border-style:dotted;
border-width:5px;
width: 100px;
height: 100px;
border-color:green;
}
.leftBox,.leftPage {
float:left;
}
.rightBox,.rightPage {
float:right;
}
</style>
</head>
<body>
<span class="leftPage"><span class="leftBox"><p class="centerBox">Leftbox</p></span>
<p>Some Text</p>
</span>
<span class="rightPage"><span class="rightBox"><p class="centerBox">rightBox</p></span>
<p>SomeText</p>
</span>
<p class="midItem">SomeText</p>
</body>
</html>
我會在短時間內將其標記爲答案。這是記錄在任何地方? – SunnyShah
我怎樣才能移除浮動,仍然得到相同的結果? – SunnyShah
閱讀這篇關於浮點數的文章http://css-tricks.com/all-about-floats/,你也可以使用'clear:both;'來清除浮點數;) –