Prev | Current Page 50 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

For instance, the following should be
avoided:

Here is a paragraph.


As previously mentioned, it??™s good practice to close tags in HTML??”even though it??™s not a
requirement for all elements, being sloppy in this area can lead to errors. Take a look at
the following:

Here is a paragraph.


Here, the emphasis element isn??™t closed, meaning subsequent text-based content on the
page is likely to be displayed in italics??”so take care to close all your tags.
Web standards and XHTML
As mentioned earlier, we??™ll be working with Extensible HyperText Markup Language
(XHTML) rules in this book, rather than HTML. The differences between HTML and XHTML
are few, but important, and largely came about because of the inconsistent way that
browsers displayed HTML. XHTML is stricter than HTML and has additional rules; oddly,
this actually makes it easier to learn, because you don??™t have to worry about things like
which case to use for tags and whether they require closing. You have hard-and-fast rules
in each case. XHTML-specific rules are as follows.
All tags and attribute names must be in lowercase and must always be closed. Therefore,
the following is incorrect:

This is a paragraph.

This is another paragraph.
You might be used to using the bold element to make text bold, but it is a physical
element that only amends the look of text rather than also conveying semantic meaning.


Pages:
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62