(hover) text-decoration: underline;
text-decoration は、文字の装飾(下線、上線、取り消し線、点滅)を指定するプロパティです。
疑似クラス(:hover)を指定したa要素にこのプロパティ(値 underline)を設定すると、ポイントした時にだけ下線を表示することができます。
※この指定内容は、リンクテキストの下線を消している場合に有効です。
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
プロパティ名 | 値 | 説明 |
---|---|---|
text-decoration | underline | テキストに下線を引く |
使用例
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>文書のタイトル</title>
<style type="text/css">
a { text-decoration: none; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<p><a href="index.html">リンクカテゴリー</a></p>
</body>
</html>
表示例
- サイト内検索