css3中before和after伪类的使用

对网页元素批量的加预定义效果

content中放的是16进制unicode编码
比如「我」的unicode是6211(16进制),content:"我" 和 content:"\6211" 的含义是一样的

<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<style>
	/*两人的对话*/
	.a::before
	{
		content:"顾客说";	
		color:red;
		font-weight:bold;
		margin-right:10px;
	}
	.b::after
	{
		content:"老板说";
		background-color:#ccc;
		border-radius:5px;
		color:blue;
		font-weight:bold;
		margin-left:10px;
	}
	/*连接*/
	a{
		position: relative;
		margin-right:50px;
		text-decoration:none;
	}
	a:hover::before,a:hover::after{position: absolute;}
	a:hover::before{
		content:'《《《';
		left:-20px;
	}

	a:hover::after{
		content:'》》》';
		right:-20px;
	}
</style>
</head>

<body>

	<p class='a'>老板,请问这条裤子多少钱?</p>
	<p class='b'>180元,广州正宗货,要不要?</p>
	<p class='a'>我先看看……</p>
	<p class='b'>别看了,东西是好东西,给你优惠点178元。</p>
	<p class='a'>这也叫优惠啊?</p>
	<p class='b'>呵呵,好吧就160元,这回可以了吧。</p>
	<br><br>
	<p>鼠标放到a标签上试试</p>
	<a href="#">baidu.com</a>
	<a href="#">blog.csdn.net</a>
	<a href="#">163.com</a>

</body>
</html>

推荐阅读:http://www.sohu.com/a/148998090_99897596

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值