構文 | 説明 |
---|---|
E::before { スタイル定義 } E:before { スタイル定義 } | E要素のコンテンツの直前に適用 |
E::after { スタイル定義 } E:after { スタイル定義 } | E要素のコンテンツの直後に適用 |
<style>
.ex::before { content: "(直前)"; color: blue; }
.ex::after { content: "(直後)"; color: red; }
</style>
<span class="ex">コンテンツ1</span>
<span class="ex">コンテンツ2</span>
<span class="ex">コンテンツ3</span>
コンテンツ1 コンテンツ2 コンテンツ3