CSS THE M\SS1NG MANUAL. David Sawyer McFarland. POGUE PRESS" O'REILLr Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo

Similar documents
the missing manual0 O'REILLY Third Edition David Sawyer McFarland Beijing Cambridge The book that should have been in the box Farnham

THIRD EDITION. CSS Cookbook. Christopher Schmitt foreword by Dan Cederholm O'REILLY 8. Beijing Cambridge Farnham Koln Sebastopol Taipei Tokyo

Cascading Style Sheets Level 2

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

Deccansoft Software Services

HTML and CSS COURSE SYLLABUS

Website Development with HTML5, CSS and Bootstrap

Certified CSS Designer VS-1028

CSS. Shan-Hung Wu CS, NTHU

COPYRIGHTED MATERIAL. Contents. Chapter 1: Creating Structured Documents 1

Table Basics. The structure of an table

CSS Selectors. element selectors. .class selectors. #id selectors

1/6/ :28 AM Approved New Course (First Version) CS 50A Course Outline as of Fall 2014

CSS.

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

Introducing Cascading Style Sheets. Cascading Style Sheet Basics Creating Styles Using Styles Manipulating Styles Text Formatting with CSS

Styles, Style Sheets, the Box Model and Liquid Layout

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

Using Dreamweaver to Create Page Layouts

HTML + CSS. ScottyLabs WDW. Overview HTML Tags CSS Properties Resources

1 of 7 11/12/2009 9:29 AM

Page Layout Using Tables

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

HTML TAG SUMMARY HTML REFERENCE 18 TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES MOST TAGS

BIM222 Internet Programming

Chapter 3 Style Sheets: CSS

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

CSE 154 LECTURE 3: MORE CSS

COMSC-031 Web Site Development- Part 2

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Class 3 Page 1. Using DW tools to learn CSS. Intro to Web Design using Dreamweaver (VBUS 010) Instructor: Robert Lee

CSS Cascading Style Sheets

The Benefits of CSS. Less work: Change look of the whole site with one edit

Symbols INDEX. !important rule, rule, , 146, , rule,

Web Engineering CSS. By Assistant Prof Malik M Ali

Chapter 1 Introduction to Dreamweaver CS3 1. About Dreamweaver CS3 Interface...4. Creating New Webpages...10

Tutorial 4: Creating Special Effects with CSS

The Importance of the CSS Box Model

Appendix D CSS Properties and Values

Creating Layouts Using CSS. Lesson 9

Discuss web browsers. Define HTML terms

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development


Create a Web Page with Spry Navigation Bar. March 30, 2010


CSS. Selectors & Measurments. Copyright DevelopIntelligence LLC

8a. Cascading Style Sheet

COPYRIGHTED MATERIAL. Contents. Introduction. Chapter 1: Structuring Documents for the Web 1

CSS: Cascading Style Sheets

Client-Side Web Technologies. CSS Part II

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

Index. CSS directive, # (octothorpe), intrapage links, 26

To link to an external stylesheet, the link element is placed within the head of the html page:

core-css.book Page i Sunday, January 9, :18 PM CORE CSS

Parashar Technologies HTML Lecture Notes-4

Chapter 4 CSS basics

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

NEW WEBMASTER HTML & CSS FOR BEGINNERS COURSE SYNOPSIS

2. Write style rules for how you d like certain elements to look.

Block & Inline Elements

Ministry of Higher Education and Scientific Research

CSS: Cascading Style Sheets

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

READSPEAKER ENTERPRISE HIGHLIGHTING 2.5

CSc 337 LECTURE 3: CSS

ADOBE 9A Adobe Dreamweaver CS4 ACE.

HTML and CSS a further introduction

Nauticom NetEditor: A How-to Guide

Final Exam Study Guide

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

TUTORIAL MADCAP FLARE Tripane and PDF

CMPT 165: More CSS Basics

Course Outline Advanced Web Design

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

CSS Cascading Style Sheets

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

Adding CSS to your HTML

ACSC 231 Internet Technologies

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Tutorial 3: Working with Cascading Style Sheets

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar with Dynamic Background Image

Adobe Dreamweaver CS6 Digital Classroom

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

Web Design and Development Tutorial 03

CSS: The Basics CISC 282 September 20, 2014

Bixby Public Schools Course Essential Elements Grade: Desktop Publishing

Table of Contents Chapter 9. Working with Cascading Style Sheets ... 1

Cascading Style Sheets (CSS)

GRAPHIC WEB DESIGNER PROGRAM

How to lay out a web page with CSS

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

Kurdistan Regional Government Iraq Ministry of Higher Education and Scientific Research, Duhok Polytechnic University

Transcription:

CSS THE M\SS1NG MANUAL David Sawyer McFarland POGUE PRESS" O'REILLr Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo

Table of Contents The Missing Credits Introduction xiii I Part One: CSS Basics Chapter 1: Rethinking HTML for CSS 15 HTML: Past and Present 15 HTML Past: Whatever Looked Good 16 HTML Present: Scaffolding for CSS 17 Writing HTML for CSS, 18 Think Structure 18 Two New HTML Tags to Learn 18 HTMLtoForget 20 Tips to Guide Your Way 21 The Importance of the Doctype 24 Chapter 2: Creating Styles and Style Sheets 27 Anatomy of a Style 27 Understanding Style Sheets 30 Internal or External-How to Choose 30 Internal Style Sheets 30 Externa! Style Sheets 31 Linking a Style Sheet Using HTML 33 Linking a Style Sheet Using CSS 33

Tutorial: Creating Your First Styles 34 Creating an Inline Style 35 Creating an Internal Style Sheet 36 Creating an External Style Sheet 39 Chapter 3: Selector Basics: Identifying What to Style 43 Tag Selectors: Page-Wide Styling 43 Class Selectors: Pinpoint Control 45 ID Selectors: Specific Page Elements 48 Styling Tags Within Tags 49 The HTML Family Tree 50 Building Descendent Selectors 51 Styling Groups of Tags 53 Constructing Group Selectors 53 The Universal Selector (Asterisk) 54 Pseudo-Classes and Pseudo-Elements 54 Styles for Links 54 More Pseudo-Classes and -Elements 55 Advanced Selectors 58 Child Selectors 58 Adjacent Siblings 60 Attribute Selectors 60 Tutorial: Selector Sampler 61 Creating a Group Selector 63 Creating and Applying a Class Selector 65 Creating and Applying an ID Selector 67 Creating a Descendent Selector 68 Chapter 4: Saving Time with Inheritance 71 What ls Inheritance? 71 How Inheritance Streamlines Style Sheets 72 The Limits of Inheritance 72 Tutorial: Inheritance 75 A Basic Example: One Level of Inheritance 75 Using Inheritance to Restyle an Entire Page 76 Inheritance Inaction 78 Chapter 5: Managing Multiple Styles: The Cascade 81 How Styles Cascade 82 Inherited Styles Accumulate 82 Nearest Ancestor Wins 82 The Directly Applied Style Wins 83 One Tag, Many Styles 84 Specificity: Which Style Wins 86 The Tiebreaker: Last Style Wins 87 vi CSS: THE MISSING MANUAL

Controlling the Cascade 89 Changing the Specificity 89 Selective Overriding 89 Tutorial: The Cascade in Action 91 Creating a Hybrid Style 92 Combining Cascading and Inheritance 93 Overcoming Conflicts 94 Part Two: Applied CSS Chapter 6: Formatting Text 99 Formatting Text 99 Choosing a Font 1 Ol Adding Color to Text 102 Changing Font Size 104 Using Pixels 104 Using Keywords, Percentages, and Ems 105 Formatting Words and Letters 108 Italicizing and Bolding 109 Capitalizing 109 Decorating 110 Letter and Word Spacing 111 Formatting Entire Paragraphs 112 Adjusting the Space Between Lines 112 Aligning Text 114 Indenting the First Line and Removing Margins 115 Formatting the First Letter or First Line of a Paragraph 117 Styling Lists 117 Types of Lists 117 Positioning Bullets and Numbers 120 Graphic Bullets 121 Tutorial: Text Formatting in Action 123 Setting Up the Page 123 Formatting the Headingsand Paragraphs 125 Formatting Lists 127 Adding the Finishing Touches 130 Chapter 7: Margins, Padding, and Borders 133 Understanding the Box Model 133 Control Space with Margins and Padding 135 Margin and Padding Shorthand 136 Colliding Margins 137 Removing Space with Negative Margins 138 Displaying Inline and Block-Level Boxes 140 TABLE OF CONTENTS

Adding Borders 141 Border Property Shorthand 143 Formatting Individual Borders 143 Coloring the Background 145 Determining Height and Width 146 Calculating a Box's Actual Width and Height 147 Controlling the Tap with the Overflow Property 148 Fixing IE 5's Broken Box Model 150 Wrap Content with Floating Elements 152 Backgrounds, Borders, and Floats 154 Stopping the Float 155 Tutorial: Margins, Backgrounds, and Borders 158 Controlling Page Margins 158 Adjusting the Space Around Tags 160 Emphasizing Text with Backgrounds and Borders 161 Building a Sidebar 163 Fixing the Browser Bugs 166 Going Further 169 Chapter 8: Adding Graphics to Web Pages 171 CSS and the <img> Tag 171 Background Images 172 Controlling Repetition 175 Positioning a Background Image 176 Keywords 177 Precise Values 179 Percentage Values 179 Fixing an Image in Place 181 Using Background Property Shorthand 182 Tutorial: Creating a Photo Gallery 183 Framing an Image 184 Adding a Caption 186 Building a Photo Gallery 188 Adding Drop Shadows 193 Tutorial: Using Background Images 195 Adding an Image to the Page Background 196 Replacing Borders with Graphics 200 Using Graphics for Bulleted Lists 201 Adding Rounded Corners to the Sidebar 203 Creating an External Style Sheet 206 Chapter 9: Sprucing Up Your Site's Navigation 209 Selecting Which Links to Style 209 Understanding Link States 209 Targeting Particular Links 211 viii CSS: THE MISSING MANUAL

Styling Links 212 Underlining Links 212 Creating a Button 214 Using Graphics 216 Building Navigation Bars 218 Using Unordered Lists 218 Vertical Navigation Bars 219 Horizontal Navigation Bars 222 Advanced Link Techniques 227 Big Clickable Buttons 227 CSS-Style Preloading Rollovers 229 Sliding Doors 231 Tutorial: Styling Links 233 Basic Link Formatting 233 Adding a Background Image toa Link 235 Highlighting External Links 237 Marking Visited Pages 239 Creating a Vertical Navigation Bar 239 Adding Rollovers and Creating "You Are Here" Links 243 Fixing the IE Bugs 246 From Vertical to Horizontal 247 Chapter 10: Formatting Tables and Forms 251 Using Tables the Right Way 251 Styling Tables 253 Adding Padding 254 Adjusting Vertical and Horizontal Alignment 254 Creating Borders 256 Styling Rows and Columns 256 Styling Forms 259 HTML Form Elements 260 Laying Out Forms Using CSS 262 Tutorial: Styling a Table 264 Tutorial: Styling a Form 268 Part Three: CSS Page Layout Chapter 11: Building Float-Based Layouts 277 How CSS Layout Works 277 The Mighty <div> Tag 278 Types of Web Page Layouts 279 Float Layout Basics 280 Applying Floats to Your Layouts 284 Floating All Columns 285 Floats Within Floats 286 Using Negative Margins to Position Elements 287 TABLE OF CONTENTS ix

Overcoming Float Problems 292 Clearing and Containing Floats 293 Creating Full-Height Columns 297 Preventing Float Drops 299 Handling Internet Explorer Bugs 302 Double-Margin Bug 302 3-Pixel Gaps 304 Other IE Problems 306 Tutorial: Multiple Column Layouts 307 Structuring the HTML 307 Creating the Layout Styles 308 Adding Another Column 309 Adding a "Faux Column" 311 Fixing the Width 313 Tutorial: Negative Margin Layout 314 Centering a Layout 314 Floating the Columns 318 Final Adjustments 322 Chapter 12: Positioning Elements on a Web Page 325 How Positioning Properties Work 326 Setting Positioning Values 328 When Absolute Positioning Is Relative 332 When (and Where) to Use Relative Positioning 333 Stacking Elements 336 Hiding Parts of a Page 337 Powerful Positioning Strategies 337 Positioning Within an Element 339 Breaking an Element Out of the Box 340 Using CSS Positioning for Page Layout 341 Creating CSS-Style Frames Using Fixed Positioning 345 Tutorial: Positioning Page Elements 350 Enhancinga Page Banner 350 Adding a Caption to a Photo 354 Laying Out the Page 357 Part Four: Advanced CSS Chapter 13: CSS for the Printed Page 365 How Media Style Sheets Work 365 How to Add Media Style Sheets 367 Specifying the Media Type for an External Style Sheet 367 Specifying the Media Type Within a Style Sheet 368 CSS: THE MISSING MANUAL

Creating Print Style Sheets 369 Using ümportantto Override Onscreen Styling 369 Reworking Text Styles 370 Styling Backgrounds for Print 371 Hiding Unwanted Page Areas 373 Adding Page Breaks for Printing 374 Tutorial: Building a Print Style Sheet 376 Remove Unneeded Page Elements 376 Removing Backgrounds and Adjusting the Layout 378 Reformatting the Text 379 Displaying the Logo 380 Displaying URLs 380 Chapter 14: Improving Your CSS Habits 383 Adding Comments 383 Organizing Styles and Style Sheets 384 Name Styles Clearly 384 Use Multiple Classes to Save Time 385 Organize Styles by Grouping 387 Using Multiple Style Sheets 388 Eliminating Browser Style Interference 390 Using Descendent Selectors 394 Compartmentalize Your Pages 394 Identify the Body 396 Managing Internet Explorer Hacks 398 Design for Contemporary Browsers First 398 Isolate CSS for IE with Conditional Comments 399 Part Five: Appendixes Appendix A: CSS Property Reference 405 Appendix B: CSS in Dreamweaver 8 433 Appendix C: CSS Resources 455 Index 463 TABLE OF CONTENTS xi