beauty.css file. The rule will automatically come into effect for each and every HTML
document that includes it.
Let’s br ie fly summarize what w e have just learned. There are three types of CSS:
inline, internal, and external. Because of the ir nature, the only really useful one is
external CSS. Inline and internal CSS may be useful for quick experimenting to see
how the design might look.
There’s another good reason why you should stick to externa l CSS. It is considered
good design if you ph ysically separate stru cture and content from presentation, which
keeps your code cleaner and easier to maintain. So, even if there’s only a single
element in stance you need to style, it is still a good idea to put styling in an extern al
style she et.
If you don’t have any questions, then I think we are ready to move ahead.
Maria: I have a question. How does CSS treat spaces? Are they important?
Professor: In CSS, spaces have pretty much the same role as in HTML. Spaces and
newlines are important to make code more readable to humans. For example, I like to
put each declaration on a separate line , slightly indented to the right, and with a space
after the colon between a property and its value. It is of course up to you how you
design your writing. T he im portant thing is that you f eel comfortable with the layout
of the code.
There is, however, one tiny restriction concerning spaces: you shouldn’t put a space
between a number and the corresponding un it. For example, if you need to write a
value of 200 pixels, the correct form is 200px, but not 200 px.
If you are in dou bt, it is always a g ood idea to validate your code. Just b ecause it
works in one browser, it doesn’t necessarily mean it is correct and will work in other
browsers as well. The same as for HTML, there exist onlin e validators for CSS. For
example, you can use th e one at
jigsaw.w3.org/css-validator.
Before you ask: CSS is case insensitive in all aspects und er its control. U nfortunately,
everyth ing is not unde r its control and there are situations where case matters. So,
same as with HTML , I suggest that you stick to lower-case letters and you’ll be fine.
3.4 CSS Values
Professor: We learned that the most basic building block of CSS is a declaration,
which assigns a value to a certain property. A question arises: which values are al-
lowed for which properties? To answer it, let’s take a closer look at d ifferent types o f
values defined by CSS.
CSS values are categorized into different data type groups, and only values belong-
ing to certa in data types are allowed to b e used for certain properties. There are, for
example, data ty pes like <color>, which is used w henever you want to set any color
property, or <len gth>, used for setting differe nt sizes and dimensions. Don’t get con-
fused by the angle bracket notation, w hich resembles an HTML tag. In CSS, a ngle
brackets are used to denote a data type.
42 Meeting 3. Presentation