– battery half – cssのみでバッテリーアイコン(半分)を描いてみた

バッテリー半分アイコン アイコン

cssのみで 「バッテリー」 アイコンを作成してみました。前回はフル充電時なので、今回は半分を作ってみました。

ソース

html

<div class="battery_half"></div>

css

/* 枠 */
.battery_half {
	font-size: 100px;
	position: relative;
	margin-top: 0.3em;
	width: 1.6em;
	height: 1.2em;
	background:
		linear-gradient(to bottom, #39a9d6 0%, #39a9d6 100%) 0em 0em / 1.3em 0.1em no-repeat,
		linear-gradient(to bottom, #39a9d6 0%, #39a9d6 100%) 1.3em 0em / 0.1em 0.2em no-repeat,
		linear-gradient(to bottom, #39a9d6 0%, #39a9d6 100%) 1.3em 0.2em / 0.3em 0.1em no-repeat,
		linear-gradient(to bottom, #39a9d6 0%, #39a9d6 100%) 1.5em 0.2em / 0.1em 0.5em no-repeat,
		linear-gradient(to bottom, #39a9d6 0%, #39a9d6 100%) 1.3em 0.7em / 0.3em 0.1em no-repeat,
		linear-gradient(to bottom, #39a9d6 0%, #39a9d6 100%) 1.3em 0.8em / 0.1em 0.2em no-repeat,
		linear-gradient(to bottom, #39a9d6 0%, #39a9d6 100%) 0em 0.9em / 1.3em 0.1em no-repeat,
		linear-gradient(to bottom, #39a9d6 0%, #39a9d6 100%) 0em 0em / 0.1em 0.9em no-repeat
	;
}
/* 残り */
.battery_half::before {
	content: "";
	position: absolute;
	top: 0.2em;
	left: 0.2em;
	width: 0.5em;
	height: 0.6em;
	background-color: #39a9d6;
}
タイトルとURLをコピーしました