Book description
As the industry standard method for enriching the presentation of HTML-based web pages, Cascading Style Sheets (CSS) allow you to give web pages more structure and a more sophisticated look. But first, you have to get past CSS theory and resolve real-world problems.
For those all-too-common dilemmas that crop up with each project, CSS Cookbook provides hundreds of practical examples with CSS code recipes that you can use immediately to format your web pages. Arranged in a quick-lookup format for easy reference, the second edition has been updated to explain the unique behavior of the latest browsers: Microsoft's IE 7 and Mozilla's Firefox 1.5. Also, the book has been expanded to cover the interaction of CSS and images and now includes more recipes for beginning CSS users. The explanation that accompanies each recipe enables you to customize the formatting for your specific needs. With topics that range from basic web typography and page layout to techniques for formatting lists, forms, and tables, this book is a must-have companion, regardless of your experience with Cascading Style Sheets.
Table of contents
- A Note Regarding Supplemental Files
- Dedication
- Preface
-
1. General
- Introduction
- Using CSS with HTML
- Using Different Selectors to Apply Styles
- Determining When to Use Class and ID Selectors
- Understanding CSS Properties
- Understanding the Box Model
- Understanding DOCTYPES and Effects on Browser Layout
- Associating Styles to a Web Page
- How to Use Different Types of Style Sheets
- Adding Comments Within CSS
- Organizing the Contents of a Style Sheet
- Organizing Style Sheet Files
- Working with Shorthand Properties
- Setting up an Alternate Style Sheet
- Using Floats with Images
- Using Absolute Positioning
- Using Relative Positioning
- Using CSS in Adobe Dreamweaver
- Using CSS in Microsoft Expression Web Designer
-
2. Web Typography
- Introduction
- Specifying Fonts
- Specifying Font Measurements and Sizes
- Gaining More Control over Font Sizes
- Enforcing Font Sizes
- Centering Text
- Setting Text to Be Justified
- Removing Space Between Headings and Paragraphs
- Setting a Simple Initial Cap
- Setting a Larger, Centered Initial Cap
- Setting an Initial Cap with Decoration (Imagery)
- Creating a Heading with Stylized Text
- Creating a Heading with Stylized Text and Borders
- Stylizing a Heading with Text and an Image
- Creating a Pull Quote with HTML Text
- Creating a Pull Quote with Borders
- Creating a Pull Quote with Images
- Setting the Indent in the First Line of a Paragraph
- Setting the Indent of Entire Paragraphs
- Creating a Hanging Indent
- Styling the First Line of a Paragraph
- Styling the First Line of a Paragraph with an Image
- Creating a Highlighted Text Effect
- Changing Line Spacing
- Adding a Graphic Treatment to HTML Text
- Placing Shadow Behind Text
- Adjusting the Spacing Between Letters and Words
-
3. Images
- Introduction
- Placing a Border Around an Image
- Removing Borders Set on Images by Default in Some Browsers
- Setting a Background Image
- Creating a Line of Background Images
- Placing a Background Image on a Web Page
- Using Multiple Background Images on One Selector
- Creating a Stationary Background Image
- Overlaying HTML Text on an Image
- Replacing HTML Text with an Image
- Replacing HTML Text with Flash Text
- Using Multiple PNGs with Transparency
- Building a Panoramic Image Presentation
- Combining Different Image Formats
- Rounding Corners with Fixed-Width Columns
- Rounding Corners (Sliding Doors Technique)
- Rounding Corners (Mountaintop Technique)
- Rounding Corners with JavaScript
- Placing a Drop Shadow Behind an Image
- Placing a Smooth Drop Shadow Behind an Image
- Making Images Scalable
- Making Word Balloons
- Hindering People from Stealing Your Images
- Inserting Reflections on Images Automatically
- Using Image Sprites
- 4. Page Elements
-
5. Lists
- Introduction
- Changing the Format of a List
- Writing Cross-Browser Indentation in Lists
- Place Dividers Between List Items
- Creating Custom Text Markers for Lists
- Creating Custom Image Markers for Lists
- Inserting Large Custom Image Markers for Lists
- Making a List Presentation Rich with Imagery
- Creating Inline Lists
- Making Hanging Indents in a List
- Moving the Marker Inside the List
-
6. Links and Navigation
- Introduction
- Removing Underlines from Links (and Adding Other Decorations)
- Changing Link Colors
- Changing Link Colors in Different Sections of a Page
- Placing an Icon at the End of the Link
- Changing Cursors
- Creating Rollovers Without JavaScript
- Creating Text Navigation Menus and Rollovers
- Building Horizontal Navigation Menus
- Building a Navigation Menu with Access Keys
- Creating Breadcrumb Navigation
- Creating Image-Based Rollovers
- Creating Collapsible Menus
- Creating Contextual Menus
- Making Tool Tips with the Title Attribute
- Designing a Dynamic Visual Menu
- Apply Styles Dynamically to a Web Page
-
7. Forms
- Introduction
- Modifying the Spacing Around a Form
- Setting Styles for Input Elements
- Applying Different Styles to Different Input Elements in the Same Form
- Setting Styles for textarea Elements
- Setting Styles for Select and Option Elements
- Creating a Macintosh-Styled Search Field
- Styling Form Buttons
- Creating an Image Submit Button
- Setting Up a Submit-Once-Only Button
- Creating a Submit Button That Looks Like HTML Text
- Making an HTML Text Link Operate Like a Submit Button
- Designing a Web Form Without Tables
- Designing a Two Column Form Without Tables
- Highlighting Form Fields
- Integrating Form Feedback with a Form
- Styling Access Keys in Web Forms
- Grouping Common Form Elements
- Entering Data into a Form Like a Spreadsheet
- Sample Design: A Login Form
- Sample Design: A Registration Form
-
8. Tables
- Introduction
- Setting the Cell Spacing
- Setting the Borders and Cell Padding
- Setting the Style for Caption
- Setting the Styles Within Table Cells
- Setting Styles for Table Header Elements
- Removing Gaps from Images Placed in Table Cells
- Eliminating Gaps Between Table Cells
- Creating Alternating Background Colors in Table Rows
- Adding a Highlighting Effect on a Table Row
- Sample Design: An Elegant Calendar
-
9. Page Layouts
- Introduction
- Building a One-Column Layout
- Building a Two-Column Layout
- Building a Two-Column Layout with Fixed-Width Columns
- Creating a Flexible Multicolumn Layout with Floats
- Creating a Fixed-Width Multicolumn Layout with Floats
- Creating a Flexible Multicolumn Layout with Positioning
- Creating a Fixed-Width Multicolumn Layout with Positioning
- Using Floats to Display Columns in Any Order
- Designing an Asymmetric Layout
- 10. Print
-
11. Hacks, Workarounds, and Troubleshooting
- Introduction
- Isolating Styles for Netscape Navigator 4.x
- Delivering Specific Styles to Internet Explorer 5.x for Windows
- Removing Web Page Flicker in Internet Explorer 5.x for Windows
- Keeping Background Images Stationary in Internet Explorer 6 for Windows
- Using Internet Explorer for Windows’ Conditional Comments to Deliver Styles
- Keeping CSS Rules from Internet Explorer 5 for Macintosh
- Setting Up an Intelligent Hack Management System
- Diagnosing CSS Bugs and Browser Issues
- Testing a Site Design on More Than One Platform with Only One Computer
- Installing More Than One Version of Internet Explorer for Windows on a Computer
- Testing a Web Site with a Text Browser
- 12. Designing with CSS
- A. Resources
- B. CSS 2.1 Properties and Proprietary Extensions
- C. CSS 2.1 Selectors, Pseudo-Classes, and Pseudo-Elements
- D. Styling of Form Elements
- Index
- Colophon
- Copyright
Product information
- Title: CSS Cookbook, 2nd Edition
- Author(s):
- Release date: October 2006
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596527419
You might also like
book
Laws of UX
An understanding of psychology—specifically the psychology behind how users behave and interact with digital interfaces—is perhaps …
book
Designing Data-Intensive Applications
Data is at the center of many challenges in system design today. Difficult issues need to …
book
Clean Code: A Handbook of Agile Software Craftsmanship
Even bad code can function. But if code isn’t clean, it can bring a development organization …
book
Designing the Search Experience
Search is not just a box and ten blue links. Search is a journey: an exploration …