<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<style>@charset "utf-8";
/*==================================================
共通 横並びのための設定
===================================*/
.gnavi {
display: flex;
flex-wrap: wrap; /*スマホ表示折り返し用なのでPCのみなら不要*/
margin: 0 0 50px 0;
list-style: none;
}
.gnavi li a {
display: block;
padding: 10px 30px;
text-decoration: none;
color: #333;
}
.gnavi li {
margin-bottom: 20px;
}
/*==================================================
左から右に線が伸びる(下部)
===================================*/
.gnavi li a {
/*線の基点とするためrelativeを指定*/
position: relative;
}
.gnavi li.current a,
.gnavi li a:hover {
color: rgba(125, 89, 252, 1);
}
.gnavi li a::after {
content: "";
/*絶対配置で線の位置を決める*/
position: absolute;
/* 「top: 100%;」でも同じ */
bottom: 0;
left: 10%;
/*線の形状*/
width: 80%;
height: 2px;
background: linear-gradient(
109.6deg,
rgba(253, 199, 141, 1) 11.3%,
rgba(249, 143, 253, 1) 100.2%
);
/*アニメーションの指定*/
transition: all 0.3s;
transform: scale(0, 5); /*X方向0、Y方向1 開始時は太めの線*/
transform-origin: left top; /*左上基点*/
}
/*現在地とhoverの設定*/
.gnavi li.current a::after,
.gnavi li a:hover::after {
transform: scale(1, 1); /*X方向にスケール拡大*/
}
/*========= レイアウトのためのCSS ===============*/
.lead {
padding: 30px 20px;
}</style>
</head>
<body>
<body>
<p class="lead">マウスポインタをメニューの上に持ってきて</p>
<ul class="gnavi">
<li class="current">
<a href="#">Home</a>
</li>
<li>
<a href="#">About</a>
</li>
<li>
<a href="#">Service</a>
</li>
<li>
<a href="#">Contact</a>
</li>
</ul>
<script>
</script>
</body>
</html>