CSSだけで作る!ホバーでアイコンが動く目を惹くお問い合わせボタン

ホバー

CSSだけで作る!ホバーでアイコンが動く目を惹くお問い合わせボタン

投稿日2026/01/20

更新日2026/1/18

お問い合わせ導線は「見つけてもらえるか」が大事。でも派手すぎるアニメーションは、サイトの雰囲気を壊したり使いにくさにつながることもあります。
このコードはCSSだけで、ホバー時にSVGアイコンの線がスーッと動く控えめな演出を追加したお問い合わせボタン。

シンプルなのに目を惹き、CTAの存在感を自然に上げられます。

Preview プレビュー

Code コード

<a class="kumonosu-service-button" href="#">
    <div class="kumonosu-icon-circle">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80">
            <g class="kumonosu-icon-line">
                <path class="kumonosu-icon-line--1" d="M25.43 53.23c-2.76 0-5-2.24-5-5V31.77c0-2.76 2.24-5 5-5h29.14c2.76 0 5 2.24 5 5v16.46c0 2.76-2.24 5-5 5" />
                <path class="kumonosu-icon-line--2" d="M54.57 26.77c2.76 0 5 2.24 5 5v16.46c0 2.76-2.24 5-5 5H25.43c-2.76 0-5-2.24-5-5V31.77c0-2.76 2.24-5 5-5" />
            </g>
            <g class="kumonosu-icon-base">
                <path d="M54.46 53.71H25.32c-2.76 0-5-2.24-5-5V32.25c0-2.76 2.24-5 5-5h29.14c2.76 0 5 2.24 5 5v16.46c0 2.76-2.24 5-5 5z" />
                <path class="kumonosu-icon-nofill" d="M24.95 35.1l14.44 8.4c0.31 0.18 0.7 0.18 1.01 0l14.44-8.4" />
            </g>
        </svg>
    </div>
    <span class="kumonosu-button-text">お問い合せはこちら</span>
</a>
html {
	font-size: 62.5%;
}
body {
	background-color: #fff;
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100vh;
	margin: 0;
	font-family: "Zen Maru Gothic", sans-serif;
}

/* --- ボタン全体(#987abe) --- */
.kumonosu-service-button {
	display: flex;
	align-items: center;
	text-decoration: none;
	background-color: #987abe;
	/* 指定の紫 */
	padding: 8px 30px 8px 8px;
	/* 70pxの円に合わせてスリムに調整 */
	border-radius: 80px;
	transition: transform 0.6s cubic-bezier(.19, 1, .22, 1),
		background-color 0.3s ease;
	cursor: pointer;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.kumonosu-service-button:hover {
	transform: scale(1.03);
	background-color: #a78bc5;
}

/* --- 左側の白い円エリア(70px) --- */
.kumonosu-icon-circle {
	width: 70px;
	height: 70px;
	background-color: #f9f8f4;
	border-radius: 50%;
	display: flex;
	justify-content: center;
	align-items: center;
	margin-right: 20px;
	position: relative;
	overflow: hidden;
	flex-shrink: 0;
}

/* アイコンを60pxに拡大 */
.kumonosu-icon-circle svg {
	width: 60px;
	height: 60px;
	display: block;
}

/* 固定の黒線 */
.kumonosu-icon-base {
	fill: none;
	stroke: #3a3937;
	stroke-width: 3.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* スーッと動くパーツ(#987abe) */
.kumonosu-icon-line path {
	fill: none;
	stroke: #987abe;
	stroke-width: 10;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: 0.6;
	transition: stroke-dashoffset 0.8s cubic-bezier(.19, 1, .22, 1);
}

/* --- 座標設定(スクショ数値を反映) --- */
.kumonosu-icon-line--1 {
	stroke-dasharray: 20px 60px;
	stroke-dashoffset: -15px;
}
.kumonosu-service-button:hover .kumonosu-icon-line--1 {
	stroke-dashoffset: -59px;
}

.kumonosu-icon-line--2 {
	stroke-dasharray: 15px 65px;
	stroke-dashoffset: -22px;
}
.kumonosu-service-button:hover .kumonosu-icon-line--2 {
	stroke-dashoffset: -58px;
}

/* 封筒のV字部分 */
.kumonosu-icon-nofill {
	fill: none;
	stroke: #3a3937;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* --- 右側のテキスト(20px指定) --- */
.kumonosu-button-text {
	color: #ffffff;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0.05em;
	white-space: nowrap;
}

Explanation 詳しい説明

仕様(このコードで起きること)

  • ボタンは 左に円形アイコン+右にテキスト の構成
  • ホバーするとボタン本体が 少し拡大(scale) して反応を出す
  • 封筒アイコンの紫ラインが stroke-dashoffset で移動し、「線が流れる」ように見える
  • JSなしで完結(hoverのみ)

カスタマイズ方法(SVGを変えればいろいろ使える)

この仕組みのポイントは、SVGの線(path)をdasharray / dashoffsetで動かしているところです。
つまり、封筒以外のSVGでも「線で構成されたアイコン」なら応用できます。

1) 色を変える

  • ボタン背景:.kumonosu-service-button { background-color: ... }
  • 動くライン:.kumonosu-icon-line path { stroke: ... }
  • ベース線:.kumonosu-icon-base { stroke: ... }

ブランドカラーに合わせるなら、ここをまとめて変更するのが最短です。

2) 動きの強さ(スピード・距離)を変える

  • 速さ:transition: stroke-dashoffset 0.8s ... の秒数を調整
  • 距離:.kumonosu-icon-line--1 / --2stroke-dashoffset の数値を調整
    → 数値差を大きくすると、線がより長く移動して「動いた感」が強くなります。

3) アイコンを差し替える(封筒→電話/チャットなど)

  • <svg ...> ... </svg> を別アイコンに置き換え
  • 置き換え先が「線(stroke)」中心のSVGなら、そのまま雰囲気を維持しやすいです

※塗り(fill)メインのアイコンだと「線が流れる演出」が効きにくいので、線画アイコンが相性◎。

4) サイズ調整

  • 円のサイズ:.kumonosu-icon-circle { width/height: 70px; }
  • アイコンサイズ:.kumonosu-icon-circle svg { width/height: 60px; }
  • テキストサイズ:.kumonosu-button-text { font-size: 20px; }

使えるシーン(おすすめ配置)

  • ヘッダー右上の「お問い合わせ」導線(目立たせたいけど主張しすぎたくない時)
  • LPのラスト(申込み/相談/見積もりの前)
  • サービス紹介ページの「相談する」「見積もり依頼」
  • 目次の下や記事末のCTA(読了後のアクションを促したい時)

気づかれる」けど「うるさくない」ので、実務で使いやすいタイプです。

注意点(実装前に押さえる)

  • ホバー前提の演出なので、スマホでは動きが出ない/出にくい環境があります
    → 動かなくても見た目が成立するデザインにしておくのが安全です(このコードはOK)。
  • transitiontransform はサイト全体の動きと合わせる
    → ほかのUIが静かなのにここだけ動きが強いと浮きます。
  • アクセシビリティ配慮をするなら
    @media (prefers-reduced-motion: reduce) でアニメーションを弱める/止めるのもおすすめです。