15

文中の単一の単語または単語のセットの色またはフォント面を変更する正しい方法は何ですか?Twitter Bootstrapを使用していて、<div>のクラスのすべての属性を継承したいのですが、それらを少しだけ微調整します。

4

1 に答える 1

24

Chordsコメントから離れて、<span>変更したいテキストを囲むタグを作成できます。複数のクラスを 1 つのスパンに簡単に追加して、必要な外観を実現することもできます。

これは、単一のスパンで複数のクラスを使用する方法を示すフィドルです。

CSS

.bold { font-weight: bold; }
.red { color: #FF0000; }
.yellow-background { background-color: Yellow; }​

HTML

Here is <span class="bold">some text</span> that we are going to apply 
<span class="bold red">different styles</span> to. You can see how 
<span class="bold yellow-background">multiple classes</span> can be used to 
change the <span class="red bold yellow-background">look and feel</span> 
of the text.​
于 2012-11-27T15:53:55.107 に答える