“Sel before”的版本间差异

本页内容
上一节: Sel_firstchild 下一节: Sel_after
(创建页面,内容为“{{DISPLAYTITLE::before}}9 = CSS :before 选择器 = 完整CSS选择器参考手册 每个 <p>元素之前插入内容: <sample title="" desc="" lang="html" hererun="1"> p:before { content:"Read this: "; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> p:before { content:"Read this -"; } </style>…”)
 
Neo讨论 | 贡献
无编辑摘要
标签已被回退
第1行: 第1行:
{{DISPLAYTITLE::before}}[[Category:css pseudo elements|9]]
{{DISPLAYTITLE::before}}[[Category:css pseudo classes|33]]
= CSS :before 选择器 =
= CSS :before 选择器 =



2022年8月19日 (五) 04:35的版本

CSS :before 选择器

完整CSS选择器参考手册

每个 <p>元素之前插入内容:


示例

p:before

    {

    content:"Read this: ";

    }

定义和说明

before 选择器向选定的元素前插入内容。

使用content 属性来指定要插入的内容。

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号。

选择器 Chrome Internet Explorer / Edge Firefox Safari Opera
::before 4.0 9.0部分从8.0 3.5 3.1 7.0部分从 4.0

注意: before在IE8中运行,必须声明 <!DOCTYPE>

相关文章

CSS 教程: CSS Pseudo-elements

CSS 选择器参考手册: CSS :after 选择器

更多实例

在每个<p>之前插入的内容和样式:


示例

p:before

    {

    content:"Read this -";

    background-color:yellow;

    color:red;

    font-weight:bold;

    }

完整CSS选择器参考手册

上一节: Sel_firstchild 下一节: Sel_after
此页面最后编辑于2022年8月19日 (星期五) 04:35。