如何使用邊框與百分比和邊距? 示例如下。邊框與百分比和邊距
<style>
.half{
width: 50%;
float: left;
background: red;
margin: 5px;
box-sizing: border-box;
box-shadow: 0px 0px 3px black;
}
</style>
<div class="half">half</div>
<div class="half">half</div>
我想股利(.half)要佔用50%的畫面 - 一個爲5px保證金各地的DIV是這個塑形我嘗試它使更廣泛的50%以上,每次使上述第2盒在下一行,如果可能,我想避免基於%的利潤率。
是的,我試過了,但在我的實際代碼下調例如我也是用box shaddows –
@MitchellBray然後使用'padding'而不是'border'。或者在'.half'元素(5px寬)內使用':after /:before'僞元素,如果水平空間足夠用於您的目的, – fcalderan
也是透明的,不會給我之後的差距。 –