書式
content:表示内容
対象
after、before疑似要素
継承
しない
初期値
なし
バージョン
CSS Level 2
対応ブラウザ
NN6.0以降, Firefox, Opera 8(?), Safari
解説
先頭および末尾に指定した文字列や画像などを追加します。以下のものが指定できます。
| 設定値 | 形状 |
| "〜" | 文字列 |
| url(〜) | 指定したURIの画像 |
| attr(〜) | 指定した属性 |
| open-quote | quotesプロパティで指定した文字列 |
| close-quote | quotesプロパティで指定した文字列 |
| no-open-quote | quotesプロパティで指定した文字列の階層を次の階層に下げる |
| no-close-quote | quotesプロパティで指定した文字列の階層を次の階層に上げる |
サンプルコード
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<style type="text/css"><!--
body { margin:0px; }
div { position:absolute; left:10px; top:10px;width:300px;height:100px;
border:1px black solid;
}
div:before { content:"CSS : " }
--></style>
</head>
<body>
<div>Sample Text</div>
</body>
</html>