zoukankan      html  css  js  c++  java
  • css :before 和 :after

    :before p:before 在每个 <p> 元素的内容之前插入内容。 2
    :after p:after 在每个 <p> 元素的内容之后插入内容。 2

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    p:before
    {
    content:"台词:";
    }
    </style>
    </head>

    <body>

    <p>我是唐老鸭。</p>
    <p>我住在 Duckburg。</p>

    <p><b>注释:</b>对于在 IE8 中工作的 :before,必须声明 DOCTYPE。</p>

    </body>
    </html>

    效果:

    台词:我是唐老鸭。

    台词:我住在 Duckburg。

    台词:注释:对于在 IE8 中工作的 :before,必须声明 DOCTYPE。

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    p:after
    {
    content:"- 台词";
    }
    </style>
    </head>

    <body>

    <p>我是唐老鸭。</p>
    <p>我住在 Duckburg。</p>

    <p><b>注释:</b>对于在 IE8 中工作的 :after,必须声明 DOCTYPE。</p>

    </body>
    </html>

    效果:

    我是唐老鸭。- 台词

    我住在 Duckburg。- 台词

    注释:对于在 IE8 中工作的 :after,必须声明 DOCTYPE。- 台词

  • 相关阅读:
    最少必要知识
    pythonGUI编程
    计算机网络基础
    .htaccess总结
    SSRF总结
    jsp学习笔记
    url任意跳转漏洞
    学期总结
    计科一班本学期作业成绩汇总表格
    C语言I博客作业08
  • 原文地址:https://www.cnblogs.com/h2zZhou/p/8043712.html
Copyright © 2011-2022 走看看