關(guān)于布局的小問題
如果將圖片設(shè)置為浮動,在一個DIV里一張左浮動,一張右浮動。并且向設(shè)置圖片距離邊框有一定距離,應(yīng)該怎么寫呢?求助啊??!各位大神們。關(guān)于這部分的代碼如下:
.contentc{position:relative;height:auto;width:100%;}
.borderleft{float:left;background:url(../images/leftyy.png) repeat-y;height:500px;width:16px;}
.borderright{float:right;background:url(../images/rightyy.png) repeat-y;height:500px;width:16px;}
? ?<div class="contentc">
? ? ? ? ? ? <div class="borderleft"></div>
? ? ? ? ? ? ?<div class="borderright"></div>
?</div>
2016-08-01
<html>
?? ?<style>
?? ??? ?.ab{width:300px;
?? ??? ??? ?height:200px;
?? ??? ??? ?background:#09f;
?? ??? ??? ? padding:10px;
?? ??? ?}
?? ??? ?.ab-1{width:100px;
?? ??? ??? ?height:100px;
?? ??? ??? ?background:#f96;
?? ???????? margin:10px;
?? ??? ??? ?float:left;
?? ??? ?}
?? ??? ?.ab-2{width:100px;
?? ??? ??? ?height:100px;
?? ??? ??? ?background:#f9f;
?? ??? ??? ?margin:10px;
?? ??? ??? ?float:right;
?? ??? ?}
?? ?</style>
?? ?<body>
?? ??? ?<div class="ab">
?? ??? ??? ?<div class="ab-1"><img src="smiley.gif" style="width:100px;height:100px"/></div>
?? ??? ??? ?<div class="ab-2"></div>
?? ??? ?</div>
?? ?</body>
</html>
2016-08-01
可以用margin 設(shè)置 外邊距
2016-08-01
.borderleft{float:left;background:url(../images/leftyy.png) repeat-y;height:500px;width:16px;margin-left:10px;}
.borderright{float:right;background:url(../images/rightyy.png) repeat-y;height:500px;width:16px;margin-right:10px;}