[装飾系]リストデザイン 区切り枠にタブで見出しをつける

CSS HTML
 2018.01.15
 2018.03.23

区切り枠にタブで見出しをつける

リスト全体を枠で囲みタブで見出しをつけます。
リストは一つ一つに区切り線をつけて、擬似要素の「:last-of-type」を使って最後だけ区切り線を外したものです。
見出しテキストは「ul::after」に設定した「content: “”;」に入れたテキストを表示しています。

browser:  65 11 20 10 
ニャン易度 
  • css
  • html
  • copy
  • easy
<ul class="cp_list">
	<li>css</li>
	<li>html</li>
	<li>copy</li>
	<li>easy</li>
</ul>
ul.cp_list {
	position: relative;
	padding: 0 0.5em;
	margin-top: 2em;
	list-style-type: none;
	border: solid 2px #29B6F6;
}
ul.cp_list::after {
	position: absolute;
	content: "LIST";
	padding: 1px 7px;
	letter-spacing: 0.05em;
	font-weight: bold;
	font-size: .8em;
	background: #29B6F6;
	color: #fff;
	bottom: 100%;
	left: -2px;
	border-radius: 4px 4px 0px 0px;
}
ul.cp_list li {
	line-height: 1.5;
	padding: 0.5em 0 0.5em 1.4em;
	border-bottom: 1px dashed #81D4FA;
}
ul.cp_list li::before {
	position: absolute;
	content: "
ul.cp_list {
position: relative;
padding: 0 0.5em;
margin-top: 2em;
list-style-type: none;
border: solid 2px #29B6F6;
}
ul.cp_list::after {
position: absolute;
content: "LIST";
padding: 1px 7px;
letter-spacing: 0.05em;
font-weight: bold;
font-size: .8em;
background: #29B6F6;
color: #fff;
bottom: 100%;
left: -2px;
border-radius: 4px 4px 0px 0px;
}
ul.cp_list li {
line-height: 1.5;
padding: 0.5em 0 0.5em 1.4em;
border-bottom: 1px dashed #81D4FA;
}
ul.cp_list li::before {
position: absolute;
content: "\002713";
color: #FF5722;
font-weight: bold;
left : 0.5em;
}
ul.cp_list li:last-of-type {
border-bottom: none;
}
2713"; color: #FF5722; font-weight: bold; left : 0.5em; } ul.cp_list li:last-of-type { border-bottom: none; }

copypet.jp

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

More Info

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