コピペでできる!CSSとhtmlだけのカウント付きリストデザイン10選

CSS HTML
 2018.01.15
 2018.03.12

htmlとcssだけでできるカウント付きリストデザイン10選です。
いわゆる[ol]のようにカウンタを利用して作るカウント付きのリストデザインです。

カウンタの利用について

cssでカウンタを利用する場合初期値をリセットしなければなりません。
リセット後には要素にカウンタの値を加えるため、 counter() 関数を使用します。

<ol class="cp_listsample">
	<li>item</li>
	<li>item</li>
	<li>item</li>
	<li>item</li>
</ol>
ol.cp_listsample {
	counter-reset: number; /* section のカウンタを 0 にセット */
}
ol.cp_listsample li:before {
	counter-increment: number; /* number カウンタを増加 */
	content: counter(number); /* カウンタを表示 */
}
  1. item
  2. item
  3. item
  4. item

また、文字列を付与させることも可能です。
counter-reset: カウンタ名(任意);
counter-increment: カウンタ名(上と同じカウンタ名);
content:counter(上と同じカウンタ名) “付与したい文字”;

ol {
	counter-reset: number; /* カウンタ名(任意) */
}
ol li:before {
	counter-increment: number; /* カウンタ名(上と同じカウンタ名) */
	content: counter(number) "付与したい文字"; /* カウンタを表示 */
}

カウンタを入れ子にする

カウンタを入れ子にする場合は自動的に子要素で生成されますが、
counters() 関数を使って、入れ子となったカウンタの異なる階層の間に、文字列を挿入することができます。

ol {
	counter-reset: number;                /* 各 ol 要素に新しいインスタンスの number カウンタを生成 */
	list-style-type: none;
}
li:before {
	counter-increment: number;            /* number カウンタのこのインスタンスのみ増加 */
	content: counters(number, ".") " ";   /* "." で区切られた number カウンタのインスタンスの値を付加 */
}
browser:  65 11 20 10 

ul/liのリストデザイン [10種]

[ol]のようにカウンタを利用して作るカウント付きのリストデザインです。

数字を丸で囲んだカウントリスト

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset:cp_clist; /*数字をリセット*/
	list-style-type: none;
	padding:0.5em;
}
ol.cp_clist li {
	position: relative;
	padding-left: 30px;
	padding: 0.5em 0.5em 0.5em 30px;
}
ol.cp_clist li::before {
	position: absolute;
	display:inline-block;
	top: 50%;
	left: 0;
	/* カウントさせる */
	counter-increment: cp_clist;
	content: counter(cp_clist);
	/*装飾*/
	padding: 0 0.2em 0 0.2em;
	background: #F4511E;
	color: #fff;
	font-weight:bold;
	border-radius: 50%;
	width: 25px;
	height: 25px;
	line-height: 25px;
	text-align:center;
	transform: translateY(-50%);
}

カウントのデザインを吹き出しに

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset:cp_clist; /*数字をリセット*/
	list-style-type: none;
	padding:0.5em;
}
ol.cp_clist li {
	position: relative;
	padding-left: 30px;
	line-height: 1.5em;
	padding: 0.5em 0.5em 0.5em 36px;
}
ol.cp_clist li::before {
	position: absolute;
	display:inline-block;
	top: 50%;
	left: 0;
	/* カウントさせる */
	counter-increment: cp_clist;
	content: counter(cp_clist);
	/*装飾*/
	padding: 0 0.2em 0 0.2em;
	background: #03A9F4;
	color: #fff;
	font-weight:bold;
	font-size: 15px;
	border-radius: 50%;
	width: 25px;
	height: 25px;
	line-height: 25px;
	text-align:center;
	transform: translateY(-50%);
}
ol.cp_clist li::after {
	position: absolute;
	content: '';
	display: block;
	top: 50%;
	left: 18px;
	height: 0;
	width: 0;
	border-top: 7px solid transparent;
	border-bottom: 7px solid transparent;
	border-left: 12px solid #03A9F4;
	transform: translateY(-50%);
}

カウントのデザインを葉っぱのような形に

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset:cp_clist;
	padding: 0.5em;
}
ol.cp_clist li{
	list-style-type:none;
	position:relative;
	display: block;
	line-height: 1.3em;
	padding: 0em 0.3em 0.3em 1.7em;
}
ol.cp_clist li::before {
	position: absolute;
	top: 0.2em;
	left: 0em;
	/* カウントさせる */
	counter-increment: cp_clist;
	content: counter(cp_clist);
	/*装飾*/
	padding: 0 0.2em 0 0.2em;
	background: #4CAF50;
	color:#fff;
	font-weight: bold;
	height: 1.3em;
	width: 1.3em;
	text-align: center;
	border-radius: 50% 1%;
}

カウントのデザインを四角い吹き出しに

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset:cp_clist;
	list-style-type:none;
	padding: 0.5em;
}
ol.cp_clist li {
	position:relative;
	line-height: 30px;
	margin: 7px 0 10px 36px;
	padding-left: 10px;
	background: #F8BBD0;
}
ol.cp_clist li:before {
	position: absolute;
	top: 50%;
	left: -40px;
	/* カウントさせる */
	counter-increment: cp_clist;
	content: counter(cp_clist);
	/*装飾*/
	padding: 0 0.2em 0 0.2em;
	font-weight: bold;
	color: #fff;
	background: #F06292;
	width: 30px;
	height: 30px;
	text-align: center;
	transform: translateY(-50%);
}
ol.cp_clist li:after {
	content:'';
	display: block;
	position: absolute;
	top: 50%;
	left: -10px;
	height: 0;
	width: 0;
	border-top: 4px solid transparent;
	border-bottom: 4px solid transparent;
	border-left: 7px solid #F06292;
	transform: translateY(-50%);
}

角丸で囲みHOVERで背景が切り替わる

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset:cp_clist;
	list-style-type:none;
	padding:0;
}
ol.cp_clist5 li {
	position:relative;
	margin: 7px 0 7px 0px;
	padding-left:40px;
	line-height: 30px;
	border: solid 1px #00BCD4;
	border-radius:20px;
	transition: 0.3s;
}
ol.cp_clist li::before {
	position: absolute;
	top: 50%;
	left: 0px;
	counter-increment: cp_clist;
	content: counter(cp_clist);
	padding: 0 0.2em 0 0.2em;
	background: #00BCD4;
	font-weight: bold;
	color: #fff;
	width: 30px;
	height: 30px;
	text-align: center;
	line-height:30px;
	border-radius: 50%;
	transform: translateY(-50%);
}
ol.cp_clist li:hover{
	background: #00BCD4;
	color: #fff;
}
ol.cp_clist li:hover:before {
	background: #fff;
	color: #00BCD4;
}

HOVERで矢印が出る

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset: cp_clist;
	list-style: none;
	padding: 0.5em;
}
ol.cp_clist ol {
	margin: 0 0 0 35px;
	padding: 0em;
}
.cp_clist li {
	position: relative;
	display: block;
	text-decoration: none;
	padding: 3px 3px 3px 8px;
	margin: 8px 0 8px 30px;
	background: #FFAB91;
	color: #333;
	transition: all .3s ease-out;
}
.cp_clist li:hover {
	background: #FFCCBC;
}
.cp_clist li::before {
	position: absolute;
	top: 50%;
	left: -35px;
	counter-increment: cp_clist;
	content: counter(cp_clist);
	padding: 0 0.2em 0 0.2em;
	margin-top: -1em;
	height: 28px;
	width: 28px;
	font-weight: bold;
	color: #fff;
	background: #FF5722;
	line-height: 28px;
	text-align: center;
}
.cp_clist li::after {
	content: '';
	position: absolute;
	top: 50%;
	left: -28px;
	margin-top: -6px;
	border: 6px solid transparent;
	transition: all .3s ease-out;
}
.cp_clist li:hover::after {
	left: -6px;
	border-left-color: #FF5722;
}

HOVERで数字が回転

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset: cp_clist;
	list-style: none;
	padding: 0.5em;
}
ol.cp_clist ol{
	margin: 0 0 0 35px;
	padding: 0em;
}
.cp_clist li {
	position: relative;
	display: block;
	padding: 4px 4px 4px 31px;
	margin: 7px 0;
	background: #9FA8DA;
	color: #333;
	text-decoration: none;
	border-radius: 5px;
	transition: all .3s ease-out;
}
.cp_clist li::before{
	counter-increment: cp_clist;
	content: counter(cp_clist);
	position: absolute;
	top: 50%;
	left: -15px;
	padding: 0 0.2em 0 0.2em;
	margin-top: -15px;
	height: 28px;
	width: 28px;
	font-weight: bold;
	background: #3F51B5;
	color: #fff;
	border: 3px solid #fff;
	text-align: center;
	border-radius: 50%;
	transition: all .3s ease-out;
}
.cp_clist li:hover{
	background: #C5CAE9;
}
.cp_clist li:hover::before{
	left: -10px;
	transform: rotate(360deg);
}

リストそれぞれ色を変えHOVERで背景が変わる

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset:cp_clist;
	list-style: none;
	padding:0.5em;
}
ol.cp_clist li {
	position: relative;
	line-height: 28px;
	margin: 10px 0;
	padding-left: 40px;
	transition: 0.3s;
}
ol.cp_clist li:nth-child(4n+1){
	border: 1px dotted #f1c6c6;
}
ol.cp_clist li:nth-child(4n+2){
	border: 1px dotted #8cd9bc;
}
ol.cp_clist li:nth-child(4n+3){
	border: 1px dotted #9575CD;
}
ol.cp_clist li:nth-child(4n+4){
	border: 1px dotted #f8e5ab;
}
ol.cp_clist li:before {
	position: absolute;
	top: 50%;
	left: -1px;
	counter-increment: cp_clist;
	content: counter(cp_clist);
	padding: 0 0.2em 0 0.2em;
	font-weight: bold;
	color: #fff;
	text-align: center;
	line-height: 30px;
	width: 30px;
	height: 30px;
	transform: translateY(-50%);
}
ol.cp_clist li:nth-child(4n+1):before{
	background: #F06292;
}
ol.cp_clist li:nth-child(4n+2):before{
	background: #4DB6AC;
}
ol.cp_clist li:nth-child(4n+3):before{
	background: #9575CD;
}
ol.cp_clist li:nth-child(4n+4):before{
	background: #FFB74D;
}
ol.cp_clist li:hover {
	color:#fff;
	overflow: hidden;
	z-index: 1;
}
ol.cp_clist li:nth-child(4n+1):hover{
	background: #F06292;
}
ol.cp_clist li:nth-child(4n+1):hover:before{
	background: #fff;
	color: #F06292;
}
ol.cp_clist li:nth-child(4n+2):hover{
	background: #4DB6AC;
}
ol.cp_clist li:nth-child(4n+2):hover:before{
	background: #fff;
	color: #4DB6AC;
}
ol.cp_clist li:nth-child(4n+3):hover{
	background: #9575CD;
}
ol.cp_clist li:nth-child(4n+3):hover:before{
	background: #fff;
	color: #9575CD;
}
ol.cp_clist li:nth-child(4n+4):hover{
	background: #FFB74D;
}
ol.cp_clist li:nth-child(4n+4):hover:before{
	background: #fff;
	color: #FFB74D;
}

HOVERでサイズが変わる

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset:cp_clist;
	padding: 0.5em 0.5em 0.5em 2em;
	list-style: none;
}
ol.cp_clist li {
	position: relative;
	padding: 0em .5em .5em 1.8em;
	margin-top: 0.8em;
	color: #333;
}
ol.cp_clist li::before {
	counter-increment: cp_clist;
	content: counter(cp_clist);
	position: absolute;
	top: 0;
	left: -5px;
	background: #F8BBD0;
	padding: 0 0.2em 0 0.2em;
	height: 1.5em;
	width: 1.5em;
	border: .1em solid rgba(0,0,0,.05);
	text-align: center;
	font: italic bold 1em/1em Georgia, Serif;
	border-radius: 1.5em;
	transition: all .2s ease-out;
}
ol.cp_clist li:hover::before {
	background-color: #F06292;
	border-color: rgba(0,0,0,.08);
	border-width: .2em;
	line-height: 0.8em;
	color: #fff;
	transform: scale(1.5);
}

カウントを利用してナンバリングする

ニャン易度
  1. css
  2. html
  3. copy
  4. easy
<ol class="cp_clist">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ol>
ol.cp_clist {
	counter-reset:cp_clist;
	margin-left: 1em;
}
ol.cp_clist li {
	position: relative;
	padding-left: 3em;
	list-style-type: none;
}
ol.cp_clist li::before {
	counter-increment: cp_clist;
	content: 'No.' counter(cp_clist) ' :';
	display: block;
	position: absolute;
	top: 0.1em;
	left: -1em;
	font-weight: bold;
}
ol.cp_clist li:nth-of-type(1)::before {
	color: #E91E63;
}
ol.cp_clist li:nth-of-type(2)::before {
	color: #4CAF50;
}
ol.cp_clist li:nth-of-type(3)::before {
	color: #FF9800;
}
ol.cp_clist li:nth-of-type(4)::before {
	color: #2196F3;
}

copypet.jp

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

More Info

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