, but they don’t matter from a CSS point of view What is important to consider is that in HTML 4, the start tags are optional in four instances: , , , and The corresponding elements will exist in the document object model (DOM) tree whether or not the tags are present in the markup It’s now considered best practice to include these tags explicitly, but an HTML document can be valid without them The , , and tags aren’t optional in XHTML; they must be included explicitly in the markup It’s permissible, even in XHTML, to omit the and tags in simple tables, not because the tags are optional—there’s no such thing as an optional tag in XML—but because XHTML allows two content models for the table element type Whereas HTML regards the tbody element tags as optional (thereby making them more tbody elements, or one or more tr elements (after any optional caption, col, colgroup, thead, and tfoot elements) The important difference is that, in an XHTML document, a table element that lacks and tags won’t contain a tbody element node in the DOM tree In HTML, the tbody element will be present in the DOM tree whether or not the tags are present This variation can affect our use of CSS in specific cases Consider the following CSS rules, which set a medium font weight for header cells in the table body www.it-ebooks.info Differences Between HTML and XHTML implicit), the XHTML specification states that a table must contain either one or 414 TheUltimateCSSReference (presumably row headers), and a bold font for other header cells (for example, those in a thead element): th { font-weight: bold; } tbody th { font-weight: normal; } Now, let’s look at two different ways to write the markup for a simple table: Blue Widgets $12.95 3 lbs ⋮ more table rows For the table above, row headings like “Blue Widgets” will have a normal font weight, regardless of whether the document uses HTML or XHTML, since the markup includes explicit and tags Here’s another example; this one omits the tags: Blue Widgets $12.95 3 lbs ⋮ more table rows The table above is a little different In an HTML document, the row headings will have a normal font weight: because the tbody element will be present in the DOM tree, the second selector will match the th elements www.it-ebooks.info Differences Between HTML and XHTML 415 In an XHTML document, however, the row headings will be bold, because only the first selector matches any th elements Omitting the and tags means that a tbody element won’t appear in the DOM tree, so the second selector won’t match the th elements in this table Root Element Properties For HTML, but not for XHTML, the CSS2.1 specification8 recommends that we specify the document background for the body element, rather than for the html element If the computed value of the background property for the html element is transparent (the initial value), any background properties specified for the body element will be applied to the canvas (p 141) This isn’t the case for XHTML The CSS2.1 specification9 also says that an overflow property declared for the body or html elements may be applied to the viewport, but only for HTML documents In reality, though, browsers apply this property to the viewport for XHTML documents too Differences Between HTML and XHTML http://www.w3.org/TR/CSS21/colors.html#background http://www.w3.org/TR/CSS21/visufx.html#overflow www.it-ebooks.info www.it-ebooks.info A Alphabetic Property Index This is a complete, alphabetical list of theCSS properties contained in this reference background 312 background-attachment 309 background-color 299 background-image 301 background-position 305 background-repeat 303 behavior 387 border 255 border-bottom 240 border-bottom-color 235 border-bottom-style 236 border-bottom-width 239 border-color 249 www.it-ebooks.info Alphabetic Property Index Appendix 418 TheUltimateCSSReference border-collapse 293 border-left 247 border-left-color 242 border-left-style 243 border-left-width 246 border-right 233 border-right-color 228 border-right-style 229 border-right-width 232 border-spacing 294 border-style 251 border-top 226 border-top-color 220 border-top-style 222 border-top-width 224 border-width 254 bottom 277 caption-side 297 clear 271 clip 283 color 315 content 348 counter-increment 352 counter-reset 354 cursor 358 direction 343 display 264 empty-cells 295 The expression Property Value 388 filter 381 www.it-ebooks.info Alphabetic Property Index 419 float 269 font 325 font-size 320 font-style 323 font-variant 324 font-weight 321 height 188 left 278 letter-spacing 326 line-height 328 list-style 290 list-style-image 289 list-style-position 288 list-style-type 286 margin 209 margin-bottom 205 margin-left 207 margin-right 202 margin-top 200 max-height 192 max-width 198 min-height 190 min-width 196 -moz-border-radius 372 -moz-box-sizing 375 The display Property Value: -moz-inline-box 377 orphans 365 outline 261 outline-color 258 www.it-ebooks.info Alphabetic Property Index font-family 318 420 TheUltimateCSSReference outline-style 259 outline-width 260 overflow 280 padding 218 padding-bottom 215 padding-left 216 padding-right 213 padding-top 212 page-break-after 364 page-break-before 362 page-break-inside 363 position 267 quotes 355 right 276 table-layout 292 text-align 330 text-decoration 332 text-indent 334 text-shadow 337 text-transform 335 top 275 unicode-bidi 344 vertical-align 338 visibility 273 white-space 341 widows 366 width 194 word-spacing 327 z-index 279 zoom 380 www.it-ebooks.info V413HAV ...www.it-ebooks.info THE ULTIMATE CSS REFERENCE BY TOMMY OLSSON & PAUL O’BRIEN www.it-ebooks.info ii The Ultimate CSS Reference The Ultimate CSS Reference by Tommy Olsson and Paul... www.it-ebooks.info What Is CSS? ■ All styling is kept in a limited number of style sheets The positive impact this The Ultimate CSS Reference CSS Versions The first CSS specification, CSS1 ,1 became a World... styled The name of the revised version was “Cascading Style Sheets, Level Revision 1” CSS2 .1 for short.3 References to CSS2 Mean CSS2 .1 Today, references to CSS2 usually mean CSS2 .1, since the original