リスト全体を枠で囲みタブで見出しをつけます。
リストは一つ一つに区切り線をつけて、擬似要素の「:last-of-type」を使って最後だけ区切り線を外したものです。
見出しテキストは「ul::after」に設定した「content: “”;」に入れたテキストを表示しています。
<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;
bottom: 100%;
left: -2px;
content: "LIST";
padding: 1px 7px;
font-weight: bold;
font-size: .8em;
color: #fff;
background: #29B6F6;
border-radius: 4px 4px 0px 0px;
}
ul.cp_list li {
padding: 5px 5px 5px 20px;
border-bottom: 1px dashed #81D4FA;
}
ul.cp_list li::before {
position: absolute;
left : 5px;
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;
bottom: 100%;
left: -2px;
content: "LIST";
padding: 1px 7px;
font-weight: bold;
font-size: .8em;
color: #fff;
background: #29B6F6;
border-radius: 4px 4px 0px 0px;
}
ul.cp_list li {
padding: 5px 5px 5px 20px;
border-bottom: 1px dashed #81D4FA;
}
ul.cp_list li::before {
position: absolute;
left : 5px;
content: "\002713";
color: #FF5722;
font-weight: bold;
}
ul.cp_list li:last-of-type {
border-bottom: none;
}
2713";
color: #FF5722;
font-weight: bold;
}
ul.cp_list li:last-of-type {
border-bottom: none;
}
CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。
@CopypetJp More Info