コピペでできる!CSSとhtmlのみのシュッとしたテキストリンク 7選

CSS HTML
 2018.04.09
 2018.07.19

htmlとcssだけでできるテキストリンク7選です。
こちらはシュッとした感じのものを中心に集めてあります。

browser:  65 11 20 10 *一部11+ 

テキストリンクデザイン [7種]

ドットラインのサイズが変わる

ニャン易度
テキストリンクテキスト-link text-テキスト
テキスト<a href="#" class="cp_textlink01">リンクテキスト-link text-</a>テキスト
.cp_textlink01 {
	position: relative;
	padding: 0.1em 0.3em;
	text-decoration: none;
	color: #FB8C00;
}
.cp_textlink01::after {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	content: '';
	transition: all 0.3s ease;
	opacity: 0.8;
	border-bottom-width: 1px;
	border-bottom-style: dotted;
	border-bottom-color: #FB8C00;
}
.cp_textlink01:hover::after {
	opacity: 1;
	border-bottom-width: 2px;
	border-bottom-style: dashed;
}

ラインのサイズが変わる

ニャン易度
テキストリンクテキスト-link text-テキスト
テキスト<a href="#" class="cp_textlink02">リンクテキスト-link text-</a>テキスト
.cp_block {
	margin: 5em auto;
	text-align: center;
}
.cp_textlink02 {
	position: relative;
	padding: 0.1em 0.3em;
	transition: all 0.3s ease;
	text-decoration: none;
	color: #00bcd4;
}
.cp_textlink02::before {
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 100%;
	height: 2px;
	content: '';
	transition: all 0.3s ease;
	background-color: #00bcd4;
}
.cp_textlink02:hover::before {
	transform: scaleY(4);
}

1本のラインがホバーで2本になる

ニャン易度
テキストリンクテキスト-link text-テキスト
テキスト<a href="#" class="cp_textlink03">リンクテキスト-link text-</a>テキスト
.cp_block {
	margin: 5em auto;
	text-align: center;
}
.cp_textlink03 {
	position: relative;
	display: inline-block;
	padding: 0.1em 0.3em;
	text-decoration: none;
	color: #009688;
}
.cp_textlink03::after,
.cp_textlink03::before {
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 100%;
	content: '';
	transition: all 0.3s ease;
	border-bottom: 2px solid #009688;
}
.cp_textlink03::before {
	opacity: 0;
}
.cp_textlink03:hover:after {
	bottom: 0;
	left: 4px;
}
.cp_textlink03:hover:before {
	bottom: -4px;
	opacity: 1;
}

アンダーラインからホバーで背景塗りつぶしに切り替わる

ニャン易度
テキストリンクテキスト-link text-テキスト
テキスト<a href="#" class="cp_textlink04">リンクテキスト-link text-</a>テキスト
.cp_block {
	margin: 5em auto;
	text-align: center;
}
.cp_textlink04 {
	position: relative;
	padding: 0.1em 0.3em;
	transition: all 0.3s ease;
	text-decoration: none;
	color: #EC407A;
}
.cp_textlink04::before {
	position: absolute;
	content: '';
	left: 0;
	bottom:0;
	width: 100%;
	height: 1%;
	transition: all 0.3s ease;
	opacity: 0;
	background-color: #EC407A;
	border-radius: 50px;
}
.cp_textlink04::after {
	position: absolute;
	bottom: -1px;
	left: 0;
	width: 100%;
	height: 2px;
	content: '';
	transition: all 0.3s ease;
	border-bottom: 2px solid #EC407A;
	opacity: 1;
}
.cp_textlink04:hover::before {
	height: 100%;
	opacity: 0.4;
}
.cp_textlink04:hover::after {
	left: 50%;
	right: 50%;
	width: 0%;
	opacity: 0;
}

上下のラインが消えて背景が塗りつぶしに切り替わる

ニャン易度
テキストリンクテキスト-link text-テキスト
テキスト<a href="#" class="cp_textlink05">リンクテキスト-link text-</a>テキスト
.cp_block {
	margin: 5em auto;
	text-align: center;
}
.cp_textlink05 {
	position: relative;
	display: inline-block;
	padding: 0.1em 0.3em;
	text-decoration: none;
	color: #3949AB;
}
.cp_textlink05:after,
.cp_textlink05::before {
	position: absolute;
	bottom: 0;
	content: '';
	transition: all 0.3s ease;
}
.cp_textlink05:after {
	right: 50%;
	left: 50%;
	width: 0;
	height: 100%;
	border-radius: 3px;
	background-color: #3949AB;
}
.cp_textlink05::before {
	left: 0;
	width: 100%;
	height: calc(100% - 2px);
	border-top: 1px solid #3949AB;
	border-bottom: 1px solid #3949AB;
}
.cp_textlink05:hover:after {
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0.3;
}
.cp_textlink05:hover::before {
	right: 50%;
	left: 50%;
	width: 0%;
}

ホバーで真ん中から背景が塗りつぶされる

ニャン易度
テキストリンクテキスト-link text-テキスト
テキスト<a href="#" class="cp_textlink06">リンクテキスト-link text-</a>テキスト
.cp_block {
	margin: 5em auto;
	text-align: center;
}
.cp_textlink06 {
	position: relative;
	display: inline-block;
	padding: 0.1em 0.3em;
	text-decoration: none;
	color: #FF8F00;
}
.cp_textlink06:after {
	position: absolute;
	bottom: 50%;
	left: 0;
	width: 100%;
	height: 2px;
	content: '';
	transition: all 0.3s ease;
	opacity: 0;
	border-radius: 10px;
	background-color: #FF8F00;
}
.cp_textlink06:hover:after {
	bottom: 0;
	height: 100%;
	opacity: 0.3;
}

ホバーで外側から枠が表示される

ニャン易度
テキストリンクテキスト-link text-テキスト
テキスト<a href="#" class="cp_textlink07">リンクテキスト-link text-</a>テキスト
.cp_block {
	margin: 5em auto;
	text-align: center;
}
.cp_textlink07 {
	position: relative;
	display: inline-block;
	padding: 0.1em 0.3em;
	text-decoration: none;
	color: #9C27B0;
}
.cp_textlink07::after,
.cp_textlink07::before {
	position: absolute;
	content: '';
	border-radius: 3px;
}
.cp_textlink07::after {
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(156,39,176 ,.4);
	transition: all 0.3s ease;
}
.cp_textlink07::before {
	top: -4px;
	bottom: -5px;
	left: -4px;
	right: -5px;
	width: calc(100% + 6px);
	height: calc(100% + 6px);
	border: 1px solid #9C27B0;
	opacity: 0;
	transition: all 0.3s;
}
.cp_textlink07:hover:after {
	background: rgba(156,39,176 ,.2);
}
.cp_textlink07:hover:before {
	top: 2px;
	left: 2px;
	width: calc(100% - 6px);
	height: calc(100% - 6px);
	opacity: 1;
}

テキストリンク第1弾は基本的なものをピックアップしています

copypet.jp

CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。

More Info

こんな記事はいかがですか?