您好,登錄后才能下訂單哦!
一、內(nèi)邊距屬性
1.定義:邊框和內(nèi)容之間的距離就是內(nèi)邊距
2.分開寫
padding-top:數(shù)字px;
padding-left:數(shù)字px;
padding-bottom:數(shù)字px;
padding-right:數(shù)字px;
3.連寫:
padding:上 右 下 左;
4.注意點:
(1)給標(biāo)簽設(shè)置內(nèi)邊距之后,標(biāo)簽占有的寬度和高度會發(fā)生變化
(2)內(nèi)邊距也會有背景顏色
web前端開發(fā)學(xué)習(xí)Q-q-u-n: ⑦⑧④-⑦⑧③-零①②,分享學(xué)習(xí)的方法和需要注意的小細(xì)節(jié),不停更新最新的教程和學(xué)習(xí)方法(詳細(xì)的前端項目實戰(zhàn)教學(xué)視頻)
<style>
div{
font-size: 25px;
width:100px;
height: 100px;
border: 1px solid red;
background-color: green;
}
.box1{
padding-top:20px;
}
.box2{
padding-left: 30px;
}
.box3{
padding-bottom: 40px;
}
.box4{
padding-right:50px;
}
.box5{
padding:40px 60px 70px 80px;
}
</style>
<body>
<div class="box1">我是段落一</div>
<div class="box2">我是段落二</div>
<div class="box3">我是段落三</div>
<div class="box4">我是段落四</div>
<div class="box5">我是段落五</div>
</body>
二、外邊距屬性
1.定義:標(biāo)簽與標(biāo)簽之間的距離就是外邊距
2.分開寫:
margin-top:數(shù)值px;
margin-left:數(shù)值px;
margin-bottom:數(shù)值px;
margin-left:數(shù)值px;
3.一起寫
margin:上 左 下 右;
4.例子
web前端開發(fā)學(xué)習(xí)Q-q-u-n: ⑦⑧④-⑦⑧③-零①②,分享學(xué)習(xí)的方法和需要注意的小細(xì)節(jié),不停更新最新的教程和學(xué)習(xí)方法(詳細(xì)的前端項目實戰(zhàn)教學(xué)視頻)
<style>
span{
width: 100px;
height:100px;
background-color: red;
margin:50px;
border:2px solid black;
}
.box1{
margin-top:20px;
}
.box2{
margin-left:30px;
}
.box3{
margin-bottom: 40px;
}
.box4{
margin-rigth:50px;
}
.box5{
margin:60px 70px 80px 90px;
}
</style>
</head>
<body>
<span class="box1">我是span</span><span class="box2">我是span</span><span class="box3">我是span</span><span class="box4">我是span</span><span class="box5">我是span</span>
5.注意點:外邊距的那一部分是沒有背景顏色的。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。