SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Sams Teach Yourself HTML & CSS in 24 Hours is a well-organized, clearly written, and generously illustrated tutorial that teaches beginners how to quickly and efficiently create high-quality web pages using the latest HTML and CSS standards.
With a practical focus on the most commonly used components of HTML and CSS, the book's 24 one-hour lessons carefully guide the reader through each step involved in creating, enhancing, and maintaining web sites of a variety of types and sizes.
The eighth edition of Sams Teach Yourself HTML & CSS in 24 Hours introduces the emerging HTML 5 specification and includes fresh material and examples that take full advantage of the book's full-color layout and design.
An online interactive learning lab offers the reader a chance to supplement all 24 lessons with step-by-step video walk-throughs of the examples, interactive online quizzes, and all the source files needed to complete the book's hands-on exercises.
In just 24 lessons of one hour or less, you can learn how to use HTML and CSS to design, create, and maintain world-class web sites. Using a clear, down-to-earth approach, each lesson builds upon the previous one, allowing even complete beginners to learn the essentials from the ground up.
Full-color figures and clear step-by-step instructions help you learn quickly.
Practical, hands-on examples show you how to apply what you learn.
Quizzes and Exercises help you test your knowledge and stretch your skills.
Learn how to…
Build your own web page and get it online in an instant
Format text for maximum clarity and readability
Create links to other pages and to other sites
Add graphics, color, and visual pizazz to your web pages
Work with transparent images and background graphics
Design your site’s layout and typography using CSS
Get user input with web-based forms
Publicize your site and make it search-engine friendly
Test a web site for compatibility with different browsers
Make your site easy to maintain and update as it grows
Free Access to Online Learning Lab
Register your book at informit.com/register for free, exclusive access to the Online Learning Lab to supplement this book’s lessons:
Video walkthroughs to show you how to complete the step-by-step examples in the book
Fast and fun online quizzes to test your understanding of each lesson
Updates or corrections as they become available
Understanding HTML and XHTML Connections
Download the sample pages (includes Chapter 3 and Index)
Contents
PART I: Getting Started on the Web
HOUR 1: Understanding How the Web Works
A Brief History of HTML and the
World Wide Web ..............................................1
Creating Web Content ......................................2
Understanding Web Content Delivery ................3
Selecting a Web Hosting Provider ......................6
Testing with Multiple Web Browsers ..................8
HOUR 2: Publishing Web Content
Creating the Sample File for this Hour ............13
Using FTP to Transfer Files..............................14
Understanding Where to Place
Files on the Web Server ................................18
Distributing Content without a Web Server ......22
Testing Web Content ....................................24
HOUR 3: Understanding HTML and XHTML
Connections
Getting Started with a Simple Web Page..........28
HTML Tags Every XHTML Web
Page Must Have ............................................32
Organizing a Page with Paragraphs
and Line Breaks ............................................34
Organizing Your Content with Headings ............36
Validating Your Web Content ..........................39
The Scoop on HTML, XML, XHTML,
and HTML 5 ..................................................41
HOUR 4: Understanding Cascading Style Sheets
How CSS Works ............................................48
A Basic Style Sheet........................................49
A CSS Style Primer ........................................54
Using Style Classes ......................................58
Using Style IDs ..............................................61
Internal Style Sheets and Inline Styles ............62
PART II: Building Blocks of Practical
Web Design
HOUR 5: Working with Text Blocks and Lists
Aligning Text on a Page ..................................68
The Three Types of HTML Lists ......................71
Placing Lists Within Lists................................73
HOUR 6: Working with Fonts
Boldface, Italics, and Special Text Formatting......82
Tweaking the Font ..........................................85
Working with Special Characters ....................89
HOUR 7: Using Tables to Display Information
Creating a Simple Table..................................96
Controlling Table Sizes ..................................99
Alignment and Spanning Within Tables ..........102
Page Layout with Tables................................105
HOUR 8: Using External and Internal Links
Using Web Addresses ..................................111
Linking Within a Page Using Anchors ............114
Linking Between Your Own Web Content ........117
Linking to External Web Content....................120
Linking to an Email Address ........................120
Opening a Link in a New Browser Window......122
Using CSS to Style Hyperlinks ......................123
HOUR 9: Working with Colors
Best Practices for Choosing Colors ..............131
Understanding Web Colors............................133
Using Hexadecimal Values for Colors ............135
Using CSS to Set Background,
Text, and Border Colors ................................136
HOUR 10: Creating Images for Use on the Web
Choosing Graphics Software ........................143
The Least You Need to Know About Graphics ....144
Preparing Photographic Images ....................145
Creating Banners and Buttons ......................151
Reducing the Number of Colors in an Image ....153
Working with Transparent Images ..................154
Creating Tiled Backgrounds ..........................154
Creating Animated Web Graphics ..................156
HOUR 11: Using Images in Your Web Site
Placing Images on a Web Page ....................162
Describing Images with Text..........................163
Specifying Image Height and Width................165
Aligning Images............................................165
Turning Images into Links ............................169
Using Background Images ............................172
Using Imagemaps ........................................173
HOUR 12: Using Multimedia in Your Web Site
Linking to Multimedia Files ..........................184
Embedding Multimedia Files ........................187
Additional Tips for Using Multimedia..............190
HOUR 13: Working with Frames
What Are Frames?........................................197
Building a Frameset ....................................199
Linking Between Frames and Windows ..........202
Using Inline Frames ....................................204
PART III: Advanced Web Page Design
with CSS
HOUR 14: Working with Margins, Padding,
Alignment, and Floating
Using Margins..............................................212
Padding Elements ........................................219
Keeping Everything Aligned ..........................223
Understanding the Float Property ..................224
HOUR 15: Understanding the CSS Box Model
and Positioning
The CSS Box Model ....................................231
The Whole Scoop on Positioning ..................235
Controlling the Way Things Stack Up..............239
Managing the Flow of Text ............................242
HOUR 16: Using CSS to Do More with Lists
HTML List Refresher ....................................245
How the CSS Box Model Affects Lists ..........246
Placing List Item Indicators ..........................249
Creating Image Maps with List
Items and CSS ..........................................251
HOUR 17: Using CSS to Design Navigation
How Navigation Lists Differ
from Regular Lists........................................259
Creating Vertical Navigation with CSS ............260
Creating Horizontal Navigation with CSS ........270
HOUR 18: Using Mouse Actions to Modify
Text Display
Creating a Tool Tip with CSS ........................277
Displaying Additional Rollover Text with CSS ....281
Accessing Events ........................................283
Using onclick to Change <div> Appearance....284
HOUR 19: Creating Fixed or Liquid Layouts
Understanding Fixed Layouts ........................294
Understanding Liquid Layouts ......................295
Creating a Fixed/Liquid Hybrid Layout............298
PART IV: Advanced Web Site
Functionality and Management
HOUR 20: Creating Print-Friendly Web Pages
What Makes a Page Print-Friendly? ................312
Applying a Media-Specific Style Sheet............315
Designing a Style Sheet for Print Pages ........317
Viewing a Web Page in Print Preview..............320
HOUR 21: Understanding Dynamic Web Sites
Understanding the Different
Types of Scripting ........................................325
Including JavaScript in HTML ........................326
Displaying Random Content ..........................328
Understanding the Document Object Model ......332
Changing Images Based on User Interaction ....333
HOUR 22: Working with Web-Based Forms
How HTML Forms Work ................................339
Creating a Form ..........................................340
Accepting Text Input ....................................344
Naming Each Piece of Form Data ..................345
Including Hidden Data in Forms ....................345
Exploring Form Input Controls ......................346
Submitting Form Data ..................................349
HOUR 23: Organizing and Managing a Web Site
When One Page Is Enough............................356
Organizing a Simple Site ..............................357
Organizing a Larger Site................................360
Writing Maintainable HTML Code ..................364
HOUR 24: Helping People Find Your Web Pages
Publicizing Your Web Site ..............................371
Listing Your Pages with the
Major Search Sites ......................................373
Providing Hints for Search Engines ................374
Additional Tips for Search
Engine Optimization......................................379
PART V: Appendixes
APPENDIX A: HTML and CSS Resources on
the Internet
General HTML, XHTML, and CSS Information ....385
Web Browsers..............................................386
Web Page Design ........................................386
Software......................................................386
Colors and Graphics ....................................387
Multimedia ..................................................388
Advanced Developer Resources ....................388
Web Site Hosting ........................................389
Web Site Services........................................389
APPENDIX B: HTML and CSS Quick Reference
HTML Structure............................................392
HTML Text Phrases and Paragraphs ..............395
XHTML Text Formatting Elements ..................398
XHTML Lists ................................................399
XHTML Links................................................400
XHTML Tables ..............................................402
XHTML Embedded Content ..........................407
XHTML Style ................................................410
XHTML Forms ..............................................410
XHTML Scripts ............................................413
XHTML Common Attributes ..........................414
CSS Dimension Style Properties ..................415
CSS Text and Font Style Properties ..............416
CSS Background Style Properties..................419
CSS Border Style Properties ........................420
CSS Margin Style Properties ........................423
CSS Padding Style Properties ......................424
CSS Layout and Display Style Properties ......424
CSS List and Marker Style Properties ............427
CSS Table Style Properties ..........................428