JavaScript,jQuery,CSS,HTMLの達人

JavaScriptとjQueryとCSSとHTMLの使い方やサンプルのブログ

CSSの基本 ~ テキストに線を付ける ~

f:id:vw-dsg:20200601063047p:plain

~ テキストに線を付ける ~

テキストに線を付けるにはテキスト装飾の「text-decoration」を使います。付けられる線の種類は「上線」「下線」「取消し線」の3種類があり、CSSでの指定方法はそれぞれ「overline」「underline」「line-through」になります。

text-decoration : overline ;         /*上線*/
text-decoration : underline;        /*下線*/
text-decoration : line-through;    /*取消し線*/

サンプルソース

<style type="text/css">
<!--
#sample-uesen {
     text-decoration : overline ;        /*上線*/
}
#sample-shitasen {
     text-decoration : underline ;      /*下線*/
}
#sample-torikeshisen {
     text-decoration : line-through ;  /*取消し線*/
}
-->

結果

これは上線です。

これは下線です。

これは取消し線です。

備考など

取消し線はHTMLの <s> タグで付けることもできます。
HTMLの基本 ~ 文字に取り消し線を入れる ~ - JavaScript & jQuery & CSS & HTML の達人

END