随笔分类 - css
摘要:flex里的两个属性连用即可达到想要的效果(写一个长方形flex盒子,并使内部元素纵向排列) flex-direction: column; justify-content: space-around; flex-direction属性: row:横向从左到右排列(左对齐),默认的排列方式。 row
阅读全文
摘要:父盒子元素里包含一个子盒子元素,给子盒子元素一个垂直外边距margin-top,父盒子元素也会跟着往下走margin-top的值,而子盒子元素和父盒子元素的边距则没有发生变化。 W3C规范中有这么一句话: In this specification, the expression collapsin
阅读全文
摘要:对图片进行剪切,保留原始比例: img.a { width: 200px; height: 400px; object-fit: cover; } 标签定义及使用说明 object-fit 属性指定元素的内容应该如何去适应指定容器的高度与宽度。 object-fit 一般用于 img 和 video
阅读全文
摘要:/* 不使用CSS变量 */ .title { background-color: red; } .desc { background-color: red; } /* 使用CSS变量 */ :root { --bg-color: red; } .title { background-color:
阅读全文