06 - CSS 属性
★CSS 颜色
html { background-color: red; } h1 { color: blue; }
★字体属性
h1 { color: blue; font-weight: bold;/* 字体粗细 */ font-size: 20px;/* 字体大小 */ font-family: sans-serif;/* 字体系列 */ }
h1 { font-size: 20px;/* 字体大小 */ }
px vs. pt vs. em vs. rem
h1 { font-weight: bold;/* 字体粗细 */ }
h1 { font-family: Helvetica, sans-serif;/* 字体系列 */ } h2 { font-family: "Times New Roman", serif; }
<head> <!-- .... --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Caveat&display=swap" rel="stylesheet"> </head>/* Link: https://fonts.google.com/specimen/Caveat */ h1 { font-family: 'Caveat', cursive; }
h1 { text-align: center;/* 文本对齐 left right start end */ }
★检查 CSS


单击style.css,显示其源码 
选择 h1,单击“添加”,就可以为这个h1添加样式




★CSS 盒子模型 - 边距、填充和边框


去除顶部边框 

无法使用padding获得元素之间的间距 



★[项目] 励志海报网站

Last updated
