P1:FMK WY022-FM WY022/Pfaffenberger WY022/Pfaffenberger-v3.cls June15,2004 23:23 HTML, XHTML, and CSS Bible 3rd Edition Brian Pfaffenberger, Steven M. Schafer, Charles White, Bill Karow WileyPublishing,Inc. i P1:FMK WY022-FM WY022/Pfaffenberger WY022/Pfaffenberger-v3.cls June15,2004 23:23 HTML, XHTML, and CSS Bible 3rd Edition Brian Pfaffenberger, Steven M. Schafer, Charles White, Bill Karow WileyPublishing,Inc. i P1:FMK WY022-FM WY022/Pfaffenberger WY022/Pfaffenberger-v3.cls June15,2004 23:23 HTML,XHTML,andCSSBible,3rdEdition Publishedby WileyPublishing,Inc. 10475CrosspointBoulevard Indianapolis,IN46256 www.wiley.com Copyright(cid:2)C 2004byWileyPublishing,Inc.,Indianapolis,Indiana PublishedsimultaneouslyinCanada eISBN:0-7645-7718-2 ManufacturedintheUnitedStatesofAmerica 10987654321 Nopartofthispublicationmaybereproduced,storedinaretrievalsystemortransmittedinanyform orbyanymeans,electronic,mechanical,photocopying,recording,scanningorotherwise,exceptas permittedunderSections107or108ofthe1976UnitedStatesCopyrightAct,withouteithertheprior writtenpermissionofthePublisher,orauthorizationthroughpaymentoftheappropriateper-copyfee totheCopyrightClearanceCenter,222RosewoodDrive,Danvers,MA01923,(978)750-8400,fax(978) 646-8600.RequeststothePublisherforpermissionshouldbeaddressedtotheLegalDepartment,Wiley Publishing,Inc.,10475CrosspointBlvd.,Indianapolis,IN46256,(317)572-3447,fax(317)572-4355, e-Mail:[email protected]. LIMITOFLIABILITY/DISCLAIMEROFWARRANTY:THEPUBLISHERANDTHEAUTHORMAKE NOREPRESENTATIONSORWARRANTIESWITHRESPECTTOTHEACCURACYORCOMPLETE- NESSOFTHECONTENTSOFTHISWORKANDSPECIFICALLYDISCLAIMALLWARRANTIES, INCLUDINGWITHOUTLIMITATIONWARRANTIESOFFITNESSFORAPARTICULARPURPOSE. NOWARRANTYMAYBECREATEDOREXTENDEDBYSALESORPROMOTIONALMATERIALS. THEADVICEANDSTRATEGIESCONTAINEDHEREINMAYNOTBESUITABLEFOREVERYSIT- UATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONALASSISTANCEISREQUIRED,THESERVICESOFACOMPETENTPROFESSIONAL PERSONSHOULDBESOUGHT.NEITHERTHEPUBLISHERNORTHEAUTHORSHALLBELIABLE FORDAMAGESARISINGHEREFROM.THEFACTTHATANORGANIZATIONORWEBSITEIS REFERREDTOINTHISWORKASACITATIONAND/ORAPOTENTIALSOURCEOFFURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATIONTHEORGANIZATIONORWEBSITEMAYPROVIDEORRECOMMENDATIONSIT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEB SITES LISTED INTHISWORKMAYHAVECHANGEDORDISAPPEAREDBETWEENWHENTHISWORKWAS WRITTENANDWHENITISREAD. Forgeneralinformationonourotherproductsandservicesortoobtaintechnicalsupport,please contactourCustomerCareDepartmentwithintheU.S.at(800)762-2974,outsidetheU.S.at(317) 572-3993orfax(317)572-4002. Wileyalsopublishesitsbooksinavarietyofelectronicformats.Somecontentthatappearsinprintmay notbeavailableinelectronicbooks. LibraryofCongressCataloging-in-PublicationData:AvailablefromPublisher Trademarks:Wiley,theWileylogo,andrelatedtradedressaretrademarksorregisteredtrademarksof JohnWiley&Sons,Inc.and/oritsaffiliates,intheUnitedStatesandothercountries,andmaynotbe usedwithoutwrittenpermission.Allothertrademarksarethepropertyoftheirrespectiveowners. WileyPublishing,Inc.,isnotassociatedwithanyproductorvendormentionedinthisbook. isatrademarkofWileyPublishing,Inc. ii P1:FMK WY022-FM WY022/Pfaffenberger WY022/Pfaffenberger-v3.cls June15,2004 23:23 About the Authors BryanPfaffenbergeristheauthorofmorethan75booksoncomputersandthe Internet,includingthebest-sellingDiscovertheInternet,fromIDGBooksWorldwide. Heteachesadvancedprofessionalcommunicationandthesociologyofcomputingin theUniversityofVirginia’sDivisionofTechnology,Culture,andCommunication. BryanlivesinCharlottesville,Virginia,withhisfamilyandanextremelyspoiledcat. StevenM.Schaferisaveteranoftechnologyandpublishing.Heprogramsinseveral languages,workswithavarietyoftechnologies,andhasbeenpublishedinseveral technicalpublicationsandarticles.HecurrentlyistheCOO/CTOforProgeny,an opensource–basedserviceandsupportcompany.Stevecanbereachedbye-mailat [email protected]. ChuckWhiteisaWebdevelopmentprofessionalwhohaswrittennumerousarticles andbooksonWebdevelopment,includingMasteringXSLTandDevelopingKillerWeb AppswithDreamweaverMXandC#,andtutorialsforIBMDeveloperWorks.Hisfirst publishedworkonCSSwasforWebTechniquesmagazinein1997,andhehasbeen workingwithlargeandsmallWebsitessince1996.HeiscurrentlyaWebsoftware engineerforeBay. BillKarow,inadditiontowritingseveralcomputerbooks,hasservedasa contributorortechnicaleditoronmorethan30otherbooks.Formerlyinchargeof systemsdevelopmentforWaltDisneyEntertainment,Billnowservesasacomputer consultantintheOrlandoareawhenhe’snotoutridinghisbicycle.Healsohasthe distinctionofhavingstoodatopmanyofthebuildingsatWaltDisneyWorld,fanfare trumpetinhand(withtheirpermission,ofcourse). iii P1:FMK WY022-FM WY022/Pfaffenberger WY022/Pfaffenberger-v3.cls June15,2004 23:23 Credits AcquisitionsEditor VicePresident&Executive JimMinatel GroupPublisher RichardSwadley DevelopmentEditor MarciaEllett VicePresidentandExecutive Publisher ProductionEditor BobIpsen GabrielleNabi VicePresidentandPublisher TechnicalEditor JosephB.Wikert Wiley-DreamtechIndiaPvtLtd ExecutiveEditorialDirector CopyEditor MaryBednarek TechBooks ProjectCoordinator EditorialManager ErinSmith MaryBethWakefield ProofreadingandIndexing TechBooksProductionServices iv P1:FMK WY022-FM WY022/Pfaffenberger WY022/Pfaffenberger-v3.cls June15,2004 23:23 ToMiri,I’lldesperatelymiss mylate-nightcompany. Steve v P1:FMK WY022-FM WY022/Pfaffenberger WY022/Pfaffenberger-v3.cls June15,2004 23:23 Acknowledgments ............................................... A booksuchasthisishardwork,andonlyasmallportionofthatworkis performedbytheauthors.Assuch,theauthorswouldliketothank thefollowing: ThemanagementteamatWileyPublishingforcontinuingtosupportlarge,tutorial- referencebookssofolkslikeyou(thereader)canbenefit. JimMinatel,forputtingtogethertheplan,assemblingtheteam,andmakingusall behave. BryanPfaffenberger,theoriginalauthorofthe1stand2ndEditionsofthisbook,for providingasolidoutlineandorganizationforustofollow. JohnDaily,whocompiledthereferentialinformationinAppendixesAandB,for steppingupandprovidingthecriticalattentiontodetailnecessaryforsuchwork. MarciaEllett,forcontinuingtobeoneofthebestdevelopmenteditorsaround— keepingusallontrackandorganized—andforprovidingcrucialinsightsand feedbackthroughouttheprocess. Wiley-DreamtechIndiaPvtLtd.forprovidingthetechnicalediting—ensuringthatthe informationisaccurateandpertinent,aswellasprovidingadditionalusefulinsights. TechBooks,forensuringthatourtextiseasytoreadandunderstand,despiteour bestefforts. Theproductioncrewwhopackagedtherawmaterialintothisnicepackageyou nowhold. Andlast,butdefinitelynotleast,ourfriendsandfamilywhogiveustheloveand supportthatenablesustodothisinthefirstplace. vi P1:FMK WY022-FM WY022/Pfaffenberger WY022/Pfaffenberger-v3.cls June15,2004 23:23 Contents at a Glance ............................................... Acknowledgments.................................................................iv Introduction....................................................................xxiii Part I: Understanding (X)HTML.....................................1 Chapter1: IntroducingtheWebandHTML.............................................3 Chapter2: WhatGoesIntoaWebPage?...............................................19 Chapter3: StartingYourWebPage....................................................43 Part II: HTML/XHTML Authoring Fundamentals..................53 Chapter4: Lines,LineBreaks,andParagraphs........................................55 Chapter5: Lists.......................................................................75 Chapter6: Images.....................................................................91 Chapter7: Links.....................................................................113 Chapter8: Text......................................................................127 Chapter9: SpecialCharacters........................................................135 Chapter10: Tables...................................................................149 Chapter11: PageLayoutwithTables.................................................173 Chapter12: Frames..................................................................189 Chapter13: Forms...................................................................205 Chapter14: Multimedia..............................................................227 Chapter15: Scripts...................................................................257 Part III: Controlling Presentation with CSS......................267 Chapter16: IntroducingCascadingStyleSheets......................................269 Chapter17: CreatingStyleRules.....................................................279 Chapter18: Fonts....................................................................297 Chapter19: TextFormatting.........................................................313 Chapter20: Padding,Margins,andBorders..........................................337 Chapter21: ColorsandBackgrounds................................................347 Chapter22: Tables...................................................................359 Chapter23: ElementPositioning.....................................................369 Chapter24: DefiningPagesforPrinting..............................................387 Part IV: Advanced Web Authoring...............................399 Chapter25: JavaScript...............................................................401 Chapter26: DynamicDHTML........................................................429 vii