HTML and CSS Reference
In-Depth Information
<hr>
<p> CSS <em class="fancy"> really </em> isn't so hard either! </p>
<p> Soon you will also <span id="heart">&hearts;</span> using CSS. </p>
<p> You can put lots of text here if you want.
We could go on and on with <span class="fancy"> fake </span> text for you
to read, but let's get back to the topic. </p>
</body>
</html>
O NLINE http://htmlref.com/ch4/hellocssworld.html
The preceding example uses some of the common CSS properties used in (X)HTML
documents and there are some slight changes to the document structure because of it, including:
• Setting colors with background-color and color
• Sizing text with font-size
• Setting boldness with font-weight
• Setting basic text alignment with text-align
• Using id and class attributes to specify elements to bind style rules to
• Using logical markup like <em> as opposed to more physical markup like <i>
• Relying on generic tag containers like <span> to style arbitrary portions of text
There are numerous other CSS properties we might employ besides the few we see here,
and we will explore those throughout the topic, but for now this sampling is enough to get
our first example up and running. In Figure 4-5, we see the CSS version of the page as
compared to the HTML-only version.
Plain HTML
HTML styled
by CSS
F IGURE 4-5 Example Hello CSS World rendering
 
Search WWH ::




Custom Search