您的位置:首页 > 技术中心 > 前端框架 >

css3中content的用法是什么

时间:2022-02-11 17:24

在css3中,content属性与“:before”及“:after”伪元素配合使用,用于在元素的前后插入内容,语法为“元素:before{content:"插入的内容";}”和“元素:after{content:"插入的内容";}”。

本教程操作环境:windows10系统、CSS3&&HTML5版、Dell G3电脑。

css3中content的用法是什么

content 属性与 :before 及 :after 伪元素配合使用,来插入内容。

语法如下:

content: normal|none|counter|attr|string|open-quote|close-quote|no-open-quote|no-close-quote|url|initial|inherit;

其中:

13.png

示例如下:

<html>
<head>
<meta charset="utf-8">
<title>123</title>
<style>
p:before { 
  content:"好好学习,";
}
</style>
</head>
<body>
<p>天天向上</p>
</body>
</html>

输出结果:

12.png

(学习视频分享:css视频教程)

以上就是css3中content的用法是什么的详细内容,更多请关注gxlsystem.com其它相关文章!

本类排行

今日推荐

热门手游