For instance, the following shorthand
#box {
margin: 0;
padding: 0 100px;
}
looks like this when written out in full:
#box {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 100px;
padding-bottom: 0;
padding-left: 100px;
}
Whether or not you use shorthand is up to you. Some designers swear by it and others
because of it. Some web design applications have options to ???force??? shorthand or avoid it
entirely. I reckon it??™s a good thing: CSS documents are usually more logical and shorter
because of shorthand. But if you don??™t agree, feel free to keep on defining margins and
padding as relevant for every edge of every element.
Setting a default font and font color
As mentioned earlier, the body start tag was historically used to house attributes for dealing
with default text and background colors, link colors, and background images. In CSS,
link styles are dealt with separately (see Chapter 5). We??™ll look at how to apply backgrounds
later in this chapter.
At this point, it??™s worth noting that, when working with CSS, the body selector is often used
to set a default font family and color for the website. We??™ll discuss working with text in
more depth in the next chapter, but for now, check out the following CSS:
THE ESSENTIAL GUIDE TO CSS AND HTML WEB DESIGN
44
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000000;
background-color: #ffffff;
}
This is straightforward.
Pages:
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108