16.伪元素

     伪元素:表示页面中一些特殊的并不真实存在的元素(特殊的位置)
  		伪元素使用::开头
     	  ::first-letter  表示第一个字母
          ::first-line    表示第一行
          ::selection     表示选中的内容
          ::before        元素的开始
          ::after         元素的最后
              - before和after必须结合content属性来使用

代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>伪元素</title>
</head>
    <style>
        /**
            伪元素:表示页面中一些特殊的并不真实存在的元素(特殊的位置)
	        伪元素使用::开头
	            ::first-letter  表示第一个字母
	            ::first-line    表示第一行
	            ::selection     表示选中的内容
	            ::before        元素的开始
	            ::after         元素的最后
	                - before和after必须结合content属性来使用
         */
        /*p元素的首字母大写*/
        p::first-letter{
            font-size: 50px;
        }
        /*p元素的第一行显示蓝色*/
        p::first-line{
            background: blue;
        }
        /*鼠标选中区域变红色*/
        p::selection{
            color: red;
        }
        /* div元素的最前面加上50px大小的· */
        div::before{
            content: '·';
            font-size: 50px;
        }

        /*div元素的末尾加上--------*/
        div::after{
            content: '--------';
            background-color: aqua;
        }
    </style>
<body>
    <div>Hello, How are you?</div>
    <div>I'm fine,Thanks!</div>
    <p>President Clinton’s decision on Apr.8 to send Chinese Premier Zhu Rongji packing without an agreement on China’s entry into the World Trade Organization seemed to be a massive miscalculation. The President took a drubbing from much of the press, which had breathlessly reported that a deal was in the bag. The Cabinet and Whit House still appeared divided, and business leaders were characterized as furious over the lost opportunity. Zhu charged that Clinton lacked “the courage” to reach an accord. And when Clinton later telephoned the angry Zhu to pledge a renewed effort at negotiations, the gesture was widely portrayed as a flip-flop.</p>
    <p>我是第二个p元素哦</p>
</body>
</html>

显示结果如下:
在这里插入图片描述
注意:红色的字体是被我用鼠标圈中的哦

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值