Table of Contents......Page 7
About the Creative Team......Page 15
Acknowledgements......Page 16
The Missing Manual Series......Page 17
How CSS Works......Page 21
The Benefits of CSS......Page 22
How HTML Tags Work......Page 23
XHTML: HTML for the New Era?......Page 25
Free Programs......Page 27
About This Book......Page 28
Living Examples......Page 30
The Very Basics......Page 31
About › These › Arrows......Page 32
Safari® Books Online......Page 33
HTML: Past and Present......Page 37
HTML Past: Whatever Looked Good......Page 38
HTML Present: Scaffolding for CSS......Page 39
Two New HTML Tags to Learn......Page 40
HTML to Forget......Page 42
Tips to Guide Your Way......Page 43
The Importance of the Doctype......Page 46
Getting the Most out of Internet Explorer 8......Page 48
Anatomy of a Style......Page 51
Internal or External—How to Choose......Page 54
Internal Style Sheets......Page 55
External Style Sheets......Page 56
Linking a Style Sheet Using HTML......Page 57
Linking a Style Sheet Using CSS......Page 58
Creating an Inline Style......Page 59
Creating an Internal Style Sheet......Page 60
Creating an External Style Sheet......Page 63
Selectors: Identifying What to Style......Page 69
Tag Selectors: Page-Wide Styling......Page 70
Class Selectors: Pinpoint Control......Page 71
ID Selectors: Specific Page Elements......Page 73
Styling Groups of Tags......Page 75
The Universal Selector (Asterisk)......Page 76
The HTML Family Tree......Page 77
Building Descendent Selectors......Page 78
Styles for Links......Page 81
:before......Page 82
:first-child......Page 84
Advanced Selectors......Page 85
Adjacent Siblings......Page 86
Attribute Selectors......Page 87
Tutorial: Selector Sampler......Page 90
Creating a Group Selector......Page 92
Creating and Applying a Class Selector......Page 93
Creating a Descendent Selector......Page 96
Creating and Applying an ID Selector......Page 97
Finishing Touches......Page 99
What Is Inheritance?......Page 101
The Limits of Inheritance......Page 103
A Basic Example: One Level of Inheritance......Page 105
Using Inheritance to Restyle an Entire Page......Page 106
Inheritance Inaction......Page 109
Managing Multiple Styles: The Cascade......Page 111
Inherited Styles Accumulate......Page 112
The Directly Applied Style Wins......Page 113
One Tag, Many Styles......Page 114
Specificity: Which Style Wins......Page 116
The Tiebreaker: Last Style Wins......Page 117
Changing the Specificity......Page 119
Selective Overriding......Page 120
Starting with a Clean Slate......Page 121
Resetting CSS and Styling from Scratch......Page 123
Creating a Hybrid Style......Page 125
Overcoming Conflicts......Page 126
Formatting Text......Page 133
Serif fonts......Page 135
Sans-serif fonts......Page 136
Additional fonts to consider......Page 137
Adding Color to Text......Page 138
Changing Font Size......Page 139
Using Pixels......Page 140
Percentages......Page 141
Ems......Page 143
Italicizing and Bolding......Page 144
Decorating......Page 145
Letter and Word Spacing......Page 147
Adjusting the Space Between Lines......Page 148
Line spacing by number......Page 149
First-line indents......Page 150
Formatting the First Letter or First Line of a Paragraph......Page 152
Types of Lists......Page 154
Positioning Bullets and Numbers......Page 155
Graphic Bullets......Page 157
Setting Up the Page......Page 158
Formatting the Headings and Paragraphs......Page 160
Formatting Lists......Page 163
Fine-Tuning with Classes......Page 164
Adding the Finishing Touches......Page 166
Understanding the Box Model......Page 171
Control Space with Margins and Padding......Page 173
Colliding Margins......Page 175
Removing Space with Negative Margins......Page 176
Displaying Inline and Block-Level Boxes......Page 178
Adding Borders......Page 180
Border Property Shorthand......Page 181
Formatting Individual Borders......Page 182
Determining Height and Width......Page 184
Calculating a Box’s Actual Width and Height......Page 185
Controlling the Tap with the Overflow Property......Page 187
Wrap Content with Floating Elements......Page 189
Stopping the Float......Page 192
Controlling Page Margins and Backgrounds......Page 195
Adjusting the Space Around Tags......Page 198
Building a Sidebar......Page 201
Fixing the Browser Bugs......Page 204
Going Further......Page 206
CSS and the
Tag......Page 207
Background Images......Page 208
Controlling Repetition......Page 213
Keywords......Page 214
Precise Values......Page 216
Percentage Values......Page 217
Using Background Property Shorthand......Page 219
Tutorial: Enhancing Images......Page 221
Framing an Image......Page 222
Adding a Caption......Page 223
Tutorial: Creating a Photo Gallery......Page 226
Adding Drop Shadows......Page 230
Tutorial: Using Background Images......Page 233
Adding an Image to the Page Background......Page 234
Replacing Borders with Graphics......Page 236
Using Graphics for Bulleted Lists......Page 238
Giving the Sidebar Personality......Page 239
Going Further......Page 243
Selecting Which Links to Style......Page 245
Understanding Link States......Page 246
Targeting Particular Links......Page 247
Styling Links......Page 248
Underlining Links......Page 249
Creating a Button......Page 251
Using Graphics......Page 253
Using Unordered Lists......Page 255
Vertical Navigation Bars......Page 256
Horizontal Navigation Bars......Page 258
Using display: inline......Page 260
Using floats for horizontal navigation......Page 261
Big Clickable Buttons......Page 264
CSS-Style Preloading Rollovers......Page 266
Sliding Doors......Page 268
Links to other websites......Page 270
Links to specific types of files......Page 271
Basic Link Formatting......Page 272
Adding a Background Image to a Link......Page 275
Highlighting Different Links......Page 276
Tutorial: Creating a Navigation Bar......Page 278
Adding Rollovers and Creating “You Are Here” Links......Page 282
Fixing the IE Bugs......Page 285
From Vertical to Horizontal......Page 286
Using Tables the Right Way......Page 291
Styling Tables......Page 293
Adjusting Vertical and Horizontal Alignment......Page 294
Creating Borders......Page 296
Styling Rows and Columns......Page 297
Styling Forms......Page 299
HTML Form Elements......Page 300
Laying Out Forms Using CSS......Page 303
Tutorial: Styling a Table......Page 304
Tutorial: Styling a Form......Page 310
Types of Web Page Layouts......Page 319
How CSS Layout Works......Page 321
The Mighty
Tag......Page 322
Techniques for CSS Layout......Page 323
Start with Your Content......Page 324
Identify the Boxes......Page 325
Remember Background Images......Page 326
Layering Elements......Page 328
Don’t Forget Margins and Padding......Page 329
Building Float-Based Layouts......Page 331
Floating All Columns......Page 335
Floats Within Floats......Page 337
Using Negative Margins to Position Elements......Page 338
Clearing and Containing Floats......Page 343
Creating Full-Height Columns......Page 348
Preventing Float Drops......Page 350
Double-Margin Bug......Page 353
3-Pixel Gaps......Page 355
Other IE Problems......Page 357
Structuring the HTML......Page 358
Creating the Layout Styles......Page 359
Adding Another Column......Page 360
Adding a “Faux Column”......Page 362
Fixing the Width......Page 364
Centering a Layout......Page 365
Floating the Columns......Page 369
Final Adjustments......Page 372
Positioning Elements on a Web Page......Page 375
How Positioning Properties Work......Page 376
Setting Positioning Values......Page 378
When Absolute Positioning Is Relative......Page 380
When (and Where) to Use Relative Positioning......Page 383
Stacking Elements......Page 385
Powerful Positioning Strategies......Page 387
Positioning Within an Element......Page 389
Breaking an Element Out of the Box......Page 390
Using CSS Positioning for Page Layout......Page 391
Creating CSS-Style Frames Using Fixed Positioning......Page 395
Enhancing a Page Banner......Page 400
Adding a Caption to a Photo......Page 404
Laying Out the Page......Page 407
How Media Style Sheets Work......Page 415
Specifying the Media Type Within a Style Sheet......Page 418
Creating Print Style Sheets......Page 419
Reworking Text Styles......Page 420
Removing background elements......Page 422
Hiding Unwanted Page Areas......Page 423
Adding Page Breaks for Printing......Page 425
Remove Unneeded Page Elements......Page 426
Adjusting the Layout......Page 429
Reformatting the Text......Page 431
Displaying URLs......Page 432
Adding Comments......Page 435
Organizing Styles and Style Sheets......Page 436
Don’t use names based on position......Page 437
Use Multiple Classes to Save Time......Page 438
Using comments to separate style groups......Page 440
Using Multiple Style Sheets......Page 441
Eliminating Browser Style Interference......Page 443
Using Descendent Selectors......Page 447
Compartmentalize Your Pages......Page 448
Identify the Body......Page 449
Managing Internet Explorer Hacks......Page 452
Isolate CSS for IE with Conditional Comments......Page 453
Conditional comments and IE 8......Page 454
Conditional comments and the cascade......Page 455
CSS 3: CSS on the Edge......Page 457
An Overview of CSS 3......Page 458
Child Selectors......Page 459
Type Selectors......Page 461
Opacity......Page 463
RGBA Color......Page 465
Simulating RGBA in Internet Explorer......Page 466
Text Shadow......Page 468
Font Freedom......Page 470
Generated Content......Page 472
Colors......Page 479
RGB values......Page 480
Percentages......Page 481
URLs......Page 482
font (inherited)......Page 483
font-variant (inherited)......Page 484
text-decoration......Page 485
vertical-align......Page 486
list-style (inherited)......Page 487
border......Page 488
border-style......Page 489
outline......Page 490
padding......Page 491
margin-top......Page 492
background-attachment......Page 493
background-position......Page 494
bottom......Page 495
clip......Page 496
height......Page 497
max-width......Page 498
overflow......Page 499
top......Page 500
z-index......Page 501
border-spacing......Page 502
table-layout......Page 503
cursor......Page 504
page-break-before......Page 505
widows......Page 506
Creating Styles......Page 507
Phase 1: Set Up the CSS Type......Page 508
Adding Styles to Web Pages......Page 511
Linking to an External Style Sheet......Page 512
Applying a Class Style......Page 513
Applying a class style to text......Page 514
Removing a Class Style......Page 515
Editing Styles......Page 516
Editing in the Properties Pane......Page 518
Managing Styles......Page 519
Deleting a Style......Page 520
Renaming a Class Style......Page 522
Moving and Managing Styles......Page 523
Examining Your CSS in the Styles Panel......Page 527
Current Selection Mode......Page 528
Deciphering the Cascade......Page 530
Using the Code Navigator......Page 533
World Wide Web Consortium (W3C)......Page 537
Discussion Boards......Page 538
Tutorials......Page 539
CSS Layout......Page 540
Layout Examples......Page 541
Windows Internet Explorer......Page 542
CSS Books......Page 543
Mac Only......Page 544
Index......Page 545