2012-11-27 7 views
8

文中の1つの単語または単語の色やフォントの面を変更する正しい方法は何ですか?私はTwitter Bootstrapを使用していて、<div>のクラスのすべての属性を継承したいと思っていますが、わずかに微調整するだけです。フォント色の中間の文章を変更するには

答えて

11

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

ここでは、a fiddleを使用して、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.​ 
+0

ビンゴ!これは私が後にしたものです。私はこれをJasonに渡しますが、このアプローチを提案するためにChordsに助言します。乾杯。 – dugla

+0

ああ、フィドルクールネス+1。 – dugla

+0

ちょうどこれを見つけて、以前はそれを考えていなかったとは思えません。 –

関連する問題