|
CSS Tutorials |
CSS TutorialsWelcome to the CSS Tutorials. In this section we cover Cascading Style Sheets, the powerful supplement to HTML that allows you complete control over the look of your websites. We'll show you how to create Cascading Style Sheets, and some of the cool tricks you can achieve with them. |
For Beginners...Introduction to CSS CSS Units For Intermediate Users...Controlling Background Images and Colours Controlling Fonts with CSS Controlling Text Appearance with CSS Making Lists Look Nicer with CSS For Advanced Users...CSS Positioning |
H1 {font: 300% Helvetica,sans-serif; font-variant: small-caps;
letter-spacing: 0.75em; text-align: right; padding-right: 1em;
line-height: 1em;}
H1:first-letter {font-size: 200%; line-height: 1px; vertical-align: -100%;}
Consulting Figure 11-16, we see that it looks about right!

H1 {padding: 0 0 0 0.25in;}H2 {padding-left: 0.25in;}Thereis one major difference between margins and padding when it comes toinline elements. Let's turn things around and talk about leftand right padding first off. Here, if we set values for the left orright padding, they will be visible, as Figure 7-60INPUT elements could be set to yellow in order to highlight the currently active input:
INPUT:focus {background: yellow;}
This style would only be applied to an element as long as it was in focus. As soon as the user switched from one input to another, the styles would be removed from the former and applied to the latter. This is a welcome capability, as it reduces the need for using JavaScript to create such effects.
textelement, realize that unless you declare awidth for that element, the CSSspecification says that its width will tend toward zero. Thus, afloated paragraph could literally be one character wide, assumingthat to be the browser's minimum value forwidth. In order to avoid this problem, make surethat you declare a width for your floated elements. Otherwise, youcould get something like Figure 7-66. make paragraphs use an upright font, as usual, and cause theEM and I elements to use anitalic font -- again, as usual.
On the other hand, you might decide that there should be a subtledifference between EM and I:
P {font-style: normal;}EM {font-style: oblique;}