复制即生效的样式
紧贴底部的footer(Sticky Footer布局)
body{
display:flex;
flex-flow:column;
min-height:100vh;
}
main{
flex:1;
}
footer{
min-height:100px;
}
flex控制布局顺序(模拟圣杯)
main{
display: flex;
align-items: stretch;
width: 100%;
}
.left{
width:200px;
order:-1;
/* 值越大越靠后 */
}
.middle{
flex:1;
}
.right{
width:200px;
}
flex排序自动对齐
.flex-container{
display: flex;
flex-wrap: wrap;
gap: 10px 20px;
/* 设置网格行列之间的间隙 */
width: 100%;
min-height: 300px;
background-color: bisque;
}
.flex-item{
flex: 0 1 calc((100% - 60px) / 4);
background-color: yellow;
}
logo自动对齐排列且混合颜色
.brands {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
/* 1fr自动分配剩余空间 */
grid-gap: 10px;
list-style-type: none;
}
.brands-item {
background: #eee;
}
.brands-item a {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.brands-item img {
width: 80px;
height: 80px;
object-fit: contain;
mix-blend-mode: multiply;
/* css混合模式 */
}
文字模糊
{
color: transparent;
text-shadow: #111 0 0 5px;
}
动态宽度
.tag{
width: clamp(100px, 50vw, 500px);
}
/* 类似于
* min-width:100px;
* width:50vw;
* max-width:500px;
*/
网页中编辑css
<style style="display:block" contentEditable>
body { color: blue }
</style>