3.5 CSS Properties
Professor: Oh yes, thanks for asking. I completely forgot. That information is implied
in the name of the property. For example, the color property is defined to specify
the color of text. It shou ld in fact be called text-color but, for historical reasons,
it is not. You can find some information about dierent color properties in the CSS
referenc e at the end of th is book, w here you’ll discover properties like border-color
or background-col or. Those, I believe, are more self-explanator y.
For example, if you want to annoy your visitors by making all text inside paragraphs
white on a ye llow background, you declare:
p {
color: white;
background-color: yellow;
}
Note that, because of the p selector, this only changes the text and background color
of pa ragraphs. Headings, for example, retain black text on a white background.
Maria: What if you p ut another element within a paragraph? For example <strong>.
Will the text inside it also become yellow?
Professor: As a matter of fact yes, bec ause the color property is inherited. We will
talk about inheritance next tim e, though.
To furthe r whet your appetite, here’s one more example. Later, you can experiment
with dierent CSS properties at h ome. Say you don’t like th e default list number-
ing using decimal numbers and want to chang e it to use lower-case roman nu merals
instead. If you look up list pr operties in the CSS reference on page 349, yo u will
find a property named list-style -type. This property allows you to select dier-
ent bullet types for unordered lists as well as numbering types f or ordered lists. Set
the list-style- type property to the l ower-roman value in order to get lower-case
roman numbering of list items:
ol {
list-style-type: lower-roman;
}
Sometimes there exist more properties that style the same aspect of an element. For
example, you can style a font by setting thin gs like a font size using the font -weight
property, a font weight using the font-size property, or a fon t face using the font-
family property:
font-weight: bold;
font-size: 20px;
font-family: sans-serif;
You can set all these properties simultaneously usin g the font shorthand property:
46 Meeting 3. Presentation
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.104.214