<!doctype html>CSS FAQ / notebook
CSS FAQ
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!doctype html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><!doctype html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!doctype html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">/* Heading default color is black */
h1 {
color: red;
}
h1 {
color: black;
}/* Heading default color is black */
h1 {
color: red;
}
h1 {
color: initial;
}<style>
.news {
background: black;
color: white;
}
.today {
font-weight: bold;
}
</style>
<div class="news today">Content of today's news goes here.</div>.news {
color: black;
}
.corpName {
font-weight: bold;
color: red;
}<!-- news item text is black, but corporate name is red and in bold -->
<div class="news">
(Reuters) <span class="corpName">General Electric</span> (GE.NYS) announced on
Thursday…
</div>#stockTicker {
font-weight: bold;
}
.stockSymbol {
color: red;
}
/* other rules */
/* other rules */
/* other rules */
.stockSymbol {
font-weight: normal;
}<!-- most text is in bold, except "GE", which is red and not bold -->
<div id="stockTicker">NYS: <span class="stockSymbol">GE</span> +1.0…</div>#stockTicker {
font-size: 12px;
font-family: "Verdana";
font-weight: bold;
}
.stockSymbol {
font: 14px "Arial";
color: red;
}<div id="stockTicker">NYS: <span class="stockSymbol">GE</span> +1.0…</div>#stockTicker {
font-weight: bold;
font: 12px "Verdana"; /* font-weight is now set to normal */
}body * {
font-weight: normal;
}
#stockTicker {
font: 12px "Verdana";
}
.corpName {
font-weight: bold;
}
.stockUp {
color: red;
}<div id="section">
NYS: <span class="corpName"><span class="stockUp">GE</span></span> +1.0…
</div>div {
color: black;
}
#orange {
color: orange;
}
.green {
color: green;
}<div id="orange" class="green" style="color: red;">This is red</div>-webkit-border-after-color: navy;
border-block-end-color: navy;