/* CSS 语法 */
/* 元素选择器 */
selector {property1: value1; property2: value2}
/* 将h1的文字设置为红色,字体大小设置为14 */
h1 {color:red; font_size:14}
/* 增加可读性 */
body {
color: #000;
background: #fff;
margin: 0;
padding: 0;
font-family: "Georgia serif";
}
/* CSS对大小写不敏感 */
/* 派生选择器 */
li strong {
font-style: italic;
font-weight: normal;
}
<p><strong>我是粗体字,不是斜体字,因为我不在列表当中,所以这个规则对我不起作用</strong></p>
<ol>
<li><strong>我是斜体字。这是因为 strong 元素位于 li 元素内。</strong></li>
<li>我是正常的字体。</li>
</ol>
/* 属性选择器 */
[class = "center"] {color:red}
<h1 class="center"> This is heading1 </h1>
css 学习1
最新推荐文章于 2024-06-27 14:10:34 发布