😅Sử dụng list-style-type để tạo icon đẹp (ok)
https://web.dev/articles/css-marker-pseudo-element
Last updated
https://web.dev/articles/css-marker-pseudo-element
Last updated
li {
display: list-item;
list-style-type: "🤯";
padding-inline-start: 1ch;
}
li:nth-child(2)::marker {
content: '!';
font-size: 2rem;
background: hsl(200 20% 88%);
animation: color-change 3s ease-in-out infinite;
}
li::marker {
content: url(/heart.svg);
content: url(#heart);
content: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='24' width='24'><path d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z' fill='none' stroke='hotpink' stroke-width='3'/></svg>");
}
<h3>Lorem ipsum dolor sit amet.</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
<h3>Itaque sequi eaque earum laboriosam.</h3>
<p>Ratione culpa reprehenderit beatae quaerat voluptatibus, debitis iusto?</p>
<h3>Laudantium sapiente commodi quidem excepturi!</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
h3 {
counter-increment: h3;
display: list-item;
}
h3::marker {
display: list-item;
content: "#" counter(h3) " ";
color: lightsalmon;
font-weight: bold;
}
body {
counter-reset: h3;
line-height: 1.4;
font-family: system-ui;
margin: 3rem;
}
<div class="test">
<ol>
<li>number 1</li>
<li>number 2</li>
<li>number 3 and some long text that goes on the next line</li>
<li>number 4</li>
<li>number 5</li>
<li>number 6:
<ol>
<li>number 1</li>
<li>number 2</li>
<li>number 3</li>
<li>number 4</li>
<li>number 5</li>
<li>number 6</li>
</ol>
</li>
<li>number 7</li>
</ol>
</div>
.test {
width: 300px;
background: #eee;
padding: 10px;
}
ol {
counter-reset: list;
margin: 0;
}
ol > li {
list-style: none;
position: relative;
}
ol > li:before {
counter-increment: list;
content: counter(list, lower-alpha) ") ";
position: absolute;
left: -1.4em;
}
input[type='radio']:after {
width: 15px;
height: 15px;
border-radius: 15px;
top: -2px;
left: -1px;
position: relative;
background-color: #d1d3d1;
content: '';
display: inline-block;
visibility: visible;
border: 2px solid white;
}
input[type='radio']:checked:after {
width: 15px;
height: 15px;
border-radius: 15px;
top: -2px;
left: -1px;
position: relative;
background-color: #ffa500;
content: '';
display: inline-block;
visibility: visible;
border: 2px solid white;
}
<input type='radio' name="gender"/>
<input type='radio' name="gender"/>