li {
margin-left: 10px;
}Introduction to the CSS cascade / notebook
Introduction to the CSS cascade
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
li {
margin-left: 0;
} /* This is a reset */@media screen {
li {
margin-left: 3px;
}
}
@media print {
li {
margin-left: 1px;
}
}
@layer namedLayer {
li {
margin-left: 5px;
}
}.specific {
margin-left: 1em;
}<ul>
<li class="specific">1<sup>st</sup></li>
<li>2<sup>nd</sup></li>
</ul>li {
margin-left: 0;
} /* from author css 1 */@media screen {
li {
margin-left: 3px;
}
}@layer namedLayer {
li {
margin-left: 5px;
}
}margin-left: 3px;<style>
@import "unlayeredStyles.css";
@import "AStyles.css" layer(A);
@import "moreUnlayeredStyles.css";
@import "BStyles.css" layer(B);
@import "CStyles.css" layer(C);
p {
color: red;
padding: 1em !important;
}
</style><p style="line-height: 1.6em; text-decoration: overline !important;">Hello</p>p {
color: red;
}
@layer B {
:root p {
color: blue;
}
}p {
color: red !important;
}
@layer B {
:root p {
color: blue !important;
}
}p {
animation: infinite 5s alternate repeatedName;
}
@keyframes repeatedName {
from {
font-size: 1rem;
}
to {
font-size: 3rem;
}
}
@layer A {
@keyframes repeatedName {
from {
background-color: yellow;
}
to {
background-color: orange;
}
}
}
@layer B {
@keyframes repeatedName {
from {
color: white;
}
to {
color: black;
}
}
}