fe6-1:CSS部分

6次阅读

共计 697 个字符,预计需要花费 2 分钟才能阅读完成。

一、CSS 的使用:内联 (inline style attribute) <head> 标签内的 <style> 标签 <link> 标签中的外联二、三种主要的选择器 (应用 CSS) 元素选择器 class 选择器 id 选择器
// 一、

// 内联
<h1 style=’background:red;’> 内联 (inline style attribute)</h1>

// 标签
<style>
h1 {
background: blue;
}
</style>
<h1>head 内的 style 标签内的 css</h1>

// 外联
<link rel=”stylesheet” href=”fe6.css”>

// 二、

// 元素选择器
<style>
h1 {
background: blue;
}
</style>
// 花括号的属性将会附加到所有带有 h1 元素的标签上

//class 选择器
<style>
.green {
background: green;
}
</style>
<h1 class=”green”>E = MC<dududu class=”square”>2</dududu> 质能公式 </h1>
<h2 class=”green”>class 选择器 </h2>
// 花括号的属性将会附加到所有带有 green 元素的标签上

//id 选择器
<style>
#id-button-test {
background: lightblue;
}
</style>
<button class=test-button id=”id-button-test”> 按钮 1</button>
<button class=test-button> 按钮 2</button>
// 花括号的属性只会附加到含 id-button-test 元素的标签上

正文完
 0