首页 > 编程开发 > CSS    日期:2021-12-29 / 来自互联网 / 浏览

css3中content的用法是什么

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

语法如下:

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

其中:

css3中content的用法是什么

示例如下:

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

输出结果:

css3中content的用法是什么

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章

1 2 3 4 5