2017-11-01 8 views
-1

Cssフォントスタイルとテキスト装飾プロパティの違いは何ですか?CSSスタイルのフォントスタイルとテキスト装飾スタイル

font-style:italic;またはtext-decoration:italic;を使用できますか?どちらが正しいのですか?違いは何ですか?

+1

あなたは私たちに尋ねるのではなく、この自分で読んでみませんか? ここで質問をする前に_努力をしてください。 https://developer.mozilla.org/en-US/docs/Web/CSS/font-style、https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration – CBroe

+0

'italic 'は' text-decoration'のための有効な値ではありません – Tanmay

答えて

0

text-decoration: italicは無効なマークアップです。
text-decorationfont-styleの両方に有効な値があります。

  • none
  • underline
  • line-through
  • overline


text-decorationは、以下の値を持つことができます

font-styleを持つことができますどこに:スタイルの

  • normal
  • italic
  • oblique

デモ:

<p style="text-decoration: none">This is a text (text-decoration: none)</p> 
 
<p style="text-decoration: underline">This is a text (text-decoration: underline)</p> 
 
<p style="text-decoration: line-through">This is a text (text-decoration: line-through)</p> 
 
<p style="text-decoration: overline">This is a text (text-decoration: overline)</p> 
 

 
<p style="font-style: normal">This is a text (font-style: normal)</p> 
 
<p style="font-style: italic">This is a text (font-style: italic)</p> 
 
<p style="font-style: oblique">This is a text (font-style: oblique)</p>

+0

各CSSプロパティの可能な値すべてをリストアップしていません。答えは**ですが、 'text-decoration:italic'は無効なマークアップです** – Tanmay

+0

私は同意しません。 OPの問題を解決するだけでなく、追加情報も提供します。この状況での追加情報は誰にも害を与えません。 – LinkinTED

+0

同意します。しかし、追加情報は完全でなければなりません。それは間違っているべきではありません。 – Tanmay