css:before :after

    xiaoxiao2026-05-14  23

    p:before是在p标签里面的前部分,after是在p标签里面的后部分

    <!DOCTYPE html>

    <html> <head> <style> p:before { content:"前面:"; background-color: #FF0000; } p:after { content:"后面:"; background-color: #0000FF; } p { background-color: #00FFFF; } </style> </head> <body> <p>我是唐老鸭。</p> <p>我住在 Duckburg。</p> <p><b>注释:</b>对于在 IE8 中工作的 :before,必须声明 DOCTYPE。</p> </body> </html>
    最新回复(0)