@import "import-styles.css"; bring one or more style sheets into another style sheet
Rule
selector{
property: value;
}
Selector
universal selector 整個頁面套用
* {
background-color: lightyellow;
}
type selector select an element type to style
header's text color **not need TEXT**
header {
color: white;
}
ID selector
#/*id*/{
background-color: lightgrey;
color: blue;
}
<!--use<p>for example-->
<p id="me">
lalalala~
</p>
class selector(best)use"." in the front and there can be multiple classes at once.(ex. h2)
.text {
color: orange;
}
.background {
background-color: lightgreen;
}
<h2 class="text background">
</h2>
<p class="text">
</p>
ID selector & class selector can use at the same time! BUT, ID selector's style will weight more~ so not using the same properties in ID and class selector—
<h2 id="id" class="class"></h2>
Descendant Selectors 後裔
use in <span>
<header>
<span>Journey through the Sierra Nevada Mountains</span>
<h1>Lake Tahoe, California</h1>
</header>
/*header+" "+span*/
header span {
color: darkblue;
font-size: 26px;
}
use in <li>
/*ul+" "+li*/
ul li {
color: purple;
font-size: 24px;
}
.main-content p {
font-weight: bold;
}
<div class="main-content">
<h2>Check out all the Wildlife</h2>
<p>
As spawning season approaches, the fish acquire a humpback and protuberant jaw. After spawning, they die and their carcasses provide a feast for gatherings of mink, bears, and Bald eagles.