Css-pseudo-element-before

提供:Dev Guides
2020年6月22日 (月) 22:39時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

CSS-擬似要素:before

説明

_:before_疑似要素は、要素の前にコンテンツを挿入するために使用されます。

以下は、_:before_要素を使用して、要素の前にコンテンツを追加する方法を示す例です。

<html>
   <head>
      <style type = "text/css">
         p:before {
            content: url(/images/bullet.gif)
         }
      </style>
   </head>

   <body>
      <p> This line will be preceded by a bullet.</p>
      <p> This line will be preceded by a bullet.</p>
      <p> This line will be preceded by a bullet.</p>
   </body>
</html>

これは、次の黒いリンクを生成します-