<div class="container">
<ul>
<li class="list-item">Unordered list item</li>
</ul>
<ol>
<li class="list-item">Ordered list item</li>
</ol>
<div class="list">
<div class="list-item">display list item</div>
</div>
</div>
<div class="form">
<label for="content">content(for ::before):</label>
<select name="content" id="contet">
<option value="'»'">»</option>
<optgroup label="字符">
<option value="'Go!'">Go!</option>
</optgroup>
<optgroup label="HTML实体符">
<option value="'➤'">➤</option>
<option value="'❢'">'❢'</option>
<option value="'\2762'">'\2762'</option>
</optgroup>
<optgroup label="表情符号">
<option value="'🔥'">🔥</option>
<option value="'🐻'">'🐻'</option>
<option value="'\01F33A'">'\01F33A'</option>
</optgroup>
<optgroup label="图片">
<option value="url('//www.w3cplus.com/sites/default/files/blogs/2021/2108/rocket.svg')">url(//www.w3cplus.com/sites/default/files/blogs/2021/2108/rocket.svg)</option>
</optgroup>
</select>
</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
inline-size: 100vw;
min-block-size: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
font-family: "Exo", Arial, sans-serif;
background-color: #f7f7f7;
line-height: 2;
}
.container {
padding: 40px;
background: #fff;
box-sizing: border-box;
box-shadow: 0 2px 4px rgb(0 0 0 / 20%);
min-width: 60vw;
max-width: 60vw;
border-radius: 5px;
position: relative;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
gap: 20px;
margin-bottom: 20px;
}
select {
max-width: 200px;
}
:root {
--content: "»";
}
.list > .list-item {
display: list-item;
}
.list-item::marker {
content: none;
}
.list-item::before {
content: var(--content);
margin-right: 10px;
display: inline-flex;
justify-content: center;
align-items: center;
color: #fff;
width: 36px;
height: 36px;
background-image: conic-gradient(from 30deg, #ff005e, #cc196c, #ff003b);
background-size: cover;
border: 1px solid rgba(255, 255, 255, 0.125);
backdrop-filter: blur(16px) saturate(180%);
background-color: rgba(17, 25, 40, 0.75);
border-radius: 50%;
font-size: 1.325rem;
text-shadow: 1px 1px 1px #3500ff;
filter: drop-shadow(1px 1px 2px rgb(0 0 0 / 0.25));
animation: spin 2.5s ease-in-out infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg) scale(1);
}
50% {
transform: rotate(720deg) scale(0.6);
filter: blur(3px);
}
100% {
transform: rotate(0deg) scale(1);
}
}
const rootEle = document.documentElement;
const select = document.getElementById("contet");
select.addEventListener("change", (etv) => {
rootEle.style.setProperty("--content", etv.target.value);
});
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.