Table of Contents......Page 6
About the Creative Team......Page 14
Acknowledgements......Page 15
The Missing Manual Series......Page 16
How CSS Works......Page 20
The Benefits of CSS......Page 21
How HTML Tags Work......Page 22
XHTML: HTML for the New Era?......Page 24
Free Programs......Page 26
About This Book......Page 27
Living Examples......Page 29
The Very Basics......Page 30
About › These › Arrows......Page 31
Safari® Books Online......Page 32
HTML: Past and Present......Page 36
HTML Past: Whatever Looked Good......Page 37
HTML Present: Scaffolding for CSS......Page 38
Two New HTML Tags to Learn......Page 39
HTML to Forget......Page 41
Tips to Guide Your Way......Page 42
The Importance of the Doctype......Page 45
Getting the Most out of Internet Explorer 8......Page 47
Anatomy of a Style......Page 50
Internal or External—How to Choose......Page 53
Internal Style Sheets......Page 54
External Style Sheets......Page 55
Linking a Style Sheet Using HTML......Page 56
Linking a Style Sheet Using CSS......Page 57
Creating an Inline Style......Page 58
Creating an Internal Style Sheet......Page 59
Creating an External Style Sheet......Page 62
Selectors: Identifying What to Style......Page 68
Tag Selectors: Page-Wide Styling......Page 69
Class Selectors: Pinpoint Control......Page 70
ID Selectors: Specific Page Elements......Page 72
Styling Groups of Tags......Page 74
The Universal Selector (Asterisk)......Page 75
The HTML Family Tree......Page 76
Building Descendent Selectors......Page 77
Styles for Links......Page 80
:before......Page 81
:first-child......Page 83
Advanced Selectors......Page 84
Adjacent Siblings......Page 85
Attribute Selectors......Page 86
Tutorial: Selector Sampler......Page 89
Creating a Group Selector......Page 91
Creating and Applying a Class Selector......Page 92
Creating a Descendent Selector......Page 95
Creating and Applying an ID Selector......Page 96
Finishing Touches......Page 98
What Is Inheritance?......Page 100
The Limits of Inheritance......Page 102
A Basic Example: One Level of Inheritance......Page 104
Using Inheritance to Restyle an Entire Page......Page 105
Inheritance Inaction......Page 108
Managing Multiple Styles: The Cascade......Page 110
Inherited Styles Accumulate......Page 111
The Directly Applied Style Wins......Page 112
One Tag, Many Styles......Page 113
Specificity: Which Style Wins......Page 115
The Tiebreaker: Last Style Wins......Page 116
Changing the Specificity......Page 118
Selective Overriding......Page 119
Starting with a Clean Slate......Page 120
Resetting CSS and Styling from Scratch......Page 122
Creating a Hybrid Style......Page 124
Overcoming Conflicts......Page 125
Formatting Text......Page 132
Serif fonts......Page 134
Sans-serif fonts......Page 135
Additional fonts to consider......Page 136
Adding Color to Text......Page 137
Changing Font Size......Page 138
Using Pixels......Page 139
Percentages......Page 140
Ems......Page 142
Italicizing and Bolding......Page 143
Decorating......Page 144
Letter and Word Spacing......Page 146
Adjusting the Space Between Lines......Page 147
Line spacing by number......Page 148
First-line indents......Page 149
Formatting the First Letter or First Line of a Paragraph......Page 151
Types of Lists......Page 153
Positioning Bullets and Numbers......Page 154
Graphic Bullets......Page 156
Setting Up the Page......Page 157
Formatting the Headings and Paragraphs......Page 159
Formatting Lists......Page 162
Fine-Tuning with Classes......Page 163
Adding the Finishing Touches......Page 165
Understanding the Box Model......Page 170
Control Space with Margins and Padding......Page 172
Colliding Margins......Page 174
Removing Space with Negative Margins......Page 175
Displaying Inline and Block-Level Boxes......Page 177
Adding Borders......Page 179
Border Property Shorthand......Page 180
Formatting Individual Borders......Page 181
Determining Height and Width......Page 183
Calculating a Box’s Actual Width and Height......Page 184
Controlling the Tap with the Overflow Property......Page 186
Wrap Content with Floating Elements......Page 188
Stopping the Float......Page 191
Controlling Page Margins and Backgrounds......Page 194
Adjusting the Space Around Tags......Page 197
Building a Sidebar......Page 200
Fixing the Browser Bugs......Page 203
Going Further......Page 205
CSS and the
Tag......Page 206
Background Images......Page 207
Controlling Repetition......Page 212
Keywords......Page 213
Precise Values......Page 215
Percentage Values......Page 216
Using Background Property Shorthand......Page 218
Tutorial: Enhancing Images......Page 220
Framing an Image......Page 221
Adding a Caption......Page 222
Tutorial: Creating a Photo Gallery......Page 225
Adding Drop Shadows......Page 229
Tutorial: Using Background Images......Page 232
Adding an Image to the Page Background......Page 233
Replacing Borders with Graphics......Page 235
Using Graphics for Bulleted Lists......Page 237
Giving the Sidebar Personality......Page 238
Going Further......Page 242
Selecting Which Links to Style......Page 244
Understanding Link States......Page 245
Targeting Particular Links......Page 246
Styling Links......Page 247
Underlining Links......Page 248
Creating a Button......Page 250
Using Graphics......Page 252
Using Unordered Lists......Page 254
Vertical Navigation Bars......Page 255
Horizontal Navigation Bars......Page 257
Using display: inline......Page 259
Using floats for horizontal navigation......Page 260
Big Clickable Buttons......Page 263
CSS-Style Preloading Rollovers......Page 265
Sliding Doors......Page 267
Links to other websites......Page 269
Links to specific types of files......Page 270
Basic Link Formatting......Page 271
Adding a Background Image to a Link......Page 274
Highlighting Different Links......Page 275
Tutorial: Creating a Navigation Bar......Page 277
Adding Rollovers and Creating “You Are Here” Links......Page 281
Fixing the IE Bugs......Page 284
From Vertical to Horizontal......Page 285
Using Tables the Right Way......Page 290
Styling Tables......Page 292
Adjusting Vertical and Horizontal Alignment......Page 293
Creating Borders......Page 295
Styling Rows and Columns......Page 296
Styling Forms......Page 298
HTML Form Elements......Page 299
Laying Out Forms Using CSS......Page 302
Tutorial: Styling a Table......Page 303
Tutorial: Styling a Form......Page 309
Types of Web Page Layouts......Page 318
How CSS Layout Works......Page 320
The Mighty
Tag......Page 321
Techniques for CSS Layout......Page 322
Start with Your Content......Page 323
Identify the Boxes......Page 324
Remember Background Images......Page 325
Layering Elements......Page 327
Don’t Forget Margins and Padding......Page 328
Building Float-Based Layouts......Page 330
Floating All Columns......Page 334
Floats Within Floats......Page 336
Using Negative Margins to Position Elements......Page 337
Clearing and Containing Floats......Page 342
Creating Full-Height Columns......Page 347
Preventing Float Drops......Page 349
Double-Margin Bug......Page 352
3-Pixel Gaps......Page 354
Other IE Problems......Page 356
Structuring the HTML......Page 357
Creating the Layout Styles......Page 358
Adding Another Column......Page 359
Adding a “Faux Column”......Page 361
Fixing the Width......Page 363
Centering a Layout......Page 364
Floating the Columns......Page 368
Final Adjustments......Page 371
Positioning Elements on a Web Page......Page 374
How Positioning Properties Work......Page 375
Setting Positioning Values......Page 377
When Absolute Positioning Is Relative......Page 379
When (and Where) to Use Relative Positioning......Page 382
Stacking Elements......Page 384
Powerful Positioning Strategies......Page 386
Positioning Within an Element......Page 388
Breaking an Element Out of the Box......Page 389
Using CSS Positioning for Page Layout......Page 390
Creating CSS-Style Frames Using Fixed Positioning......Page 394
Enhancing a Page Banner......Page 399
Adding a Caption to a Photo......Page 403
Laying Out the Page......Page 406
How Media Style Sheets Work......Page 414
Specifying the Media Type Within a Style Sheet......Page 417
Creating Print Style Sheets......Page 418
Reworking Text Styles......Page 419
Removing background elements......Page 421
Hiding Unwanted Page Areas......Page 422
Adding Page Breaks for Printing......Page 424
Remove Unneeded Page Elements......Page 425
Adjusting the Layout......Page 428
Reformatting the Text......Page 430
Displaying URLs......Page 431
Adding Comments......Page 434
Organizing Styles and Style Sheets......Page 435
Don’t use names based on position......Page 436
Use Multiple Classes to Save Time......Page 437
Using comments to separate style groups......Page 439
Using Multiple Style Sheets......Page 440
Eliminating Browser Style Interference......Page 442
Using Descendent Selectors......Page 446
Compartmentalize Your Pages......Page 447
Identify the Body......Page 448
Managing Internet Explorer Hacks......Page 451
Isolate CSS for IE with Conditional Comments......Page 452
Conditional comments and IE 8......Page 453
Conditional comments and the cascade......Page 454
CSS 3: CSS on the Edge......Page 456
An Overview of CSS 3......Page 457
Child Selectors......Page 458
Type Selectors......Page 460
Opacity......Page 462
RGBA Color......Page 464
Simulating RGBA in Internet Explorer......Page 465
Text Shadow......Page 467
Font Freedom......Page 469
Generated Content......Page 471
Colors......Page 478
RGB values......Page 479
Percentages......Page 480
URLs......Page 481
font (inherited)......Page 482
font-variant (inherited)......Page 483
text-decoration......Page 484
vertical-align......Page 485
list-style (inherited)......Page 486
border......Page 487
border-style......Page 488
outline......Page 489
padding......Page 490
margin-top......Page 491
background-attachment......Page 492
background-position......Page 493
bottom......Page 494
clip......Page 495
height......Page 496
max-width......Page 497
overflow......Page 498
top......Page 499
z-index......Page 500
border-spacing......Page 501
table-layout......Page 502
cursor......Page 503
page-break-before......Page 504
widows......Page 505
Creating Styles......Page 506
Phase 1: Set Up the CSS Type......Page 507
Adding Styles to Web Pages......Page 510
Linking to an External Style Sheet......Page 511
Applying a Class Style......Page 512
Applying a class style to text......Page 513
Removing a Class Style......Page 514
Editing Styles......Page 515
Editing in the Properties Pane......Page 517
Managing Styles......Page 518
Deleting a Style......Page 519
Renaming a Class Style......Page 521
Moving and Managing Styles......Page 522
Examining Your CSS in the Styles Panel......Page 526
Current Selection Mode......Page 527
Deciphering the Cascade......Page 529
Using the Code Navigator......Page 532
World Wide Web Consortium (W3C)......Page 536
Discussion Boards......Page 537
Tutorials......Page 538
CSS Layout......Page 539
Layout Examples......Page 540
Windows Internet Explorer......Page 541
CSS Books......Page 542
Mac Only......Page 543
Index......Page 544