选择文字颜色:伪类选择器::selection
::selection {
color: #fff;
background-color: #f00;
}
p::selection {
background-color: #0f0;
}
立体按钮制作
.btn {
padding: 10px 20px;
border-radius: 10px;
background-image: linear-gradient(skyblue, pink);
font-size: 50px;
color: #fff;
cursor: pointer;
border: 0;
box-shadow: 0 10px 0 skyblue;
transition: all 300ms;
}
.btn:active {
box-shadow: 0 5px 0 skyblue;
transform: translate3d(0, 5px, 0);
}
图片阴影
.img-shadow {
width: 200px;
height: 200px;
border-radius: 50%;
background: url("") no-repeat center/cover;
position: relative;
}
.img-shadow::after {
content: "";
left: 0;
top: 10%;
position: absolute;
width: 100%;
height: 100%;
background: inherit;
border-radius: 50%;
z-index: -1;
filter: blur(30px) brightness(80%) opacity(.8);
}
bject-fit属性
img {
width: 200px;
height: 200px;
object-fit: fill;
}
滚动条样式
ul {
width: 200px;
display: flex;
overflow: auto;
}
ul::-webkit-scrollbar {
height: 6px;
}
ul::-webkit-scrollbar-thumb {
border-radius: 5px;
background-color: #f00;
}
ul::-webkit-scrollbar-track {
border-radius: 5px;
background-color: skyblue;
}
li {
width: 100px;
height: 100px;
flex-shrink: 0;
text-align: center;
}
花里胡哨的文字
h1 {
background: url("");
color: transparent;
-webkit-background-clip: text;
font-size: 120px;
}
background: linear-gradient(270deg, #ffffff 0%, skyblue 100%);
-webkit-text-stroke: 1px blue;