CHAPTER 2 n HTML, CSS, AND JAVASCRIPT 16
CSS Basics
Like HTML, I??™m assuming that you know the general CSS syntax, but I do want to review some
of the basics. I will also cover some strategies to make CSS management easier, especially for
interacting with JavaScript.
Say It with Meaning
Revisiting the semantic issue, I mentioned that using elements appropriate for the content is
advantageous and I??™ll show you why in this section. Here is an example without meaning:
This is a header
This is some text content.
Here is some additional content with emphasis anda
strong emphasis.
From a CSS perspective, you have no way to isolate styles to any one particular element.
Obviously, it doesn??™t work. So, let??™s add some meaning:
This is some text content.
Here is some additional content with a
emphasis and strong emphasis.
Look at that??”the code now has meaning, doesn??™t it? It does, but it??™s terribly inefficient.
You haven??™t taken advantage of the innate power of HTML. Let??™s try it one more time:
This is a header
This is some text content.
Here is some additional content with emphasis and stronga
emphasis.
You accomplished two goals by using semantic HTML:
??? You added meaning to the document that the browser understands.
Pages:
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59