次のようなスパンがあるとします。
<span> This is my string » and it continues </span>
そして、そのスパンの内側にあるフォントの色を黒にします。ただし、»を赤にします。
そうするための良い方法は何でしょうか?
ありがとう
最良のHTML/CSSの方法は
<span> This is my string <span>»</span> and it continues </span>
<span>
好きなようにインナーをスタイリングします
span { color: #000 }
span span { color: #c00 }
<span>
別のタグで包みます。<span>
最善の方法は、次のように別のタグでラップすることです。
<span> This is my string <span class="r">»</span> and it continues </span>
そして、このようにスタイルを与えます:
span span.r {color: red;}
別の要素でラップして»
、それをスタイリングしてみてください。
html:
<span> This is my string <em>»</em> and it continues</span>
css:
span { color: #000000; }
span em { color: #ff0000; font-style: normal; }