css3中content的用法是什么

来自:互联网
时间: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的用法是什么

返回顶部
顶部