20170608学习笔记整理

一.精通CSS第四章

1.固定宽度的圆角框

HTML:

<div class="box">
		<h2>yyc change the world</h2>
		<p class="last">
			Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin venenatis turpis ut quam. In dolor. Nam ultrices nisl sollicitudin sapien. Ut lacinia aliquet ante.
		</p>
</div>

CSS

/*将顶部图像应用于标题元素,将底部图像应用于div框的底部。因为两个
背景图像是单色的,所以可在div框上添加同色背景,形成框的主体*/
.box{
width: 418px;
background: #effce7 url(../images/bottom.gif) no-repeat left
bottom;
}
.box h2{
color:teal;
background: url(../images/top.gif) no-repeat left top;
}
/*为了内容不碰到框的边界,所以在div中的元素上添加一点内边距*/
.box{
padding-bottom: 1px;
}
.box h2{
margin-top: 0;
padding:20px 20px 0 20px;
}
.box p{
padding:0 20px;
}
 
/*重新设置内容、上、下背景,为了设置圆角框,再来点左右边距
(上左下右)*/
.box{
width:424px;
background: url(../images/tile2.gif) repeat-y;
}
.box h2{
background: url(../images/top2.gif) no-repeat left top;
padding-top: 20px;
}
.box .last{
background: url(../images/bottom2.gif) no-repeat left bottom;
padding-bottom: 20px;
}
.box h2,.box p{
padding:0 20px 0 20px;
}
/*BUG*/
p{
margin-bottom: -10px;
}


Result:



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值