Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore Front -End Web Development

Front -End Web Development

Published by Angarag, 2022-12-06 17:43:43

Description: Front -End Web Development

Search

Read the Text Version

["<\/html> Atom\tand\temmet\thave\ttogether\tsaved\tyou\tsome\ttyping\tand\thelped\tyou\tbuild\twell-formed initial\tHTML. Let\u2019s\texamine\tyour\tcode.\tThe\tfirst\tline,\t<!doctype\thtml>,\tdefines\tthe\tdoctype\t\u2013\tit\ttells the\tbrowser\twhich\tversion\tof\tHTML\tthe\tdocument\tis\twritten\tin.\tThe\tbrowser\tmay\trender, or\tdraw,\tthe\tpage\ta\tlittle\tdifferently\tbased\tthe\tdoctype.\tHere,\tthe\tdoctype\tspecifies HTML5. Earlier\tversions\tof\tHTML\toften\thad\tlong,\tconvoluted,\tand\thard\tto\tremember\tdoctypes, such\tas: <!DOCTYPE\thtml\tPUBLIC\t\\\"-\/\/W3C\/\/DTD\tXHTML\t1.0\tTransitional\/\/EN\\\" \\\"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\\\"> Often,\tfolks\thad\tto\tlook\tup\tthe\tdoctype\teach\ttime\tthey\tcreated\ta\tnew\tdocument. With\tHTML5,\tthe\tdoctype\tis\tshort\tand\tsweet.\tIt\tis\tthe\tone\tthat\twill\tbe\tused\tthroughout\tall of\tthe\tprojects\tin\tthis\tbook,\tand\tyou\tshould\tuse\tit\tfor\tyour\tapps. After\tthe\tdoctype\tis\tsome\tbasic\tHTML\tmarkup\tconsisting\tof\ta\thead\tand\ta\tbody. The\thead\twill\thold\tinformation\tabout\tthe\tdocument\tand\thow\tthe\tbrowser\tshould\thandle the\tdocument.\tFor\texample,\tthe\ttitle\tof\tthe\tdocument,\twhat\tCSS\tor\tJavaScript\tfiles\tthe page\tuses,\tand\twhen\tthe\tdocument\twas\tlast\tmodified\tare\tall\tincluded\tin\tthe\thead. Here,\tthe\thead\tcontains\ta\t<meta>\ttag.\t<meta>\ttags\tprovide\tthe\tbrowser\twith\tinformation about\tthe\tdocument\titself,\tsuch\tas\tthe\tname\tof\tthe\tdocument\u2019s\tauthor\tor\tkeywords\tfor search\tengines.\tThe\t<meta>\ttag\tin\tOttergram,\t<meta\tcharset=\\\"utf-8\\\">,\tspecifies\tthat\tthe document\tis\tencoded\tusing\tthe\tUTF-8\tcharacter\tset,\twhich\tencompasses\tall\tUnicode characters.\tUse\tthis\ttag\tin\tyour\tdocuments\tso\tthat\tthe\twidest\trange\tof\tbrowsers\tcan interpret\tthem\tcorrectly,\tespecially\tif\tyou\texpect\tinternational\ttraffic. The\tbody\twill\thold\tall\tof\tthe\tHTML\tcode\tthat\trepresents\tthe\tcontent\tof\tyour\tpage:\tall\tthe images,\tlinks,\ttext,\tbuttons,\tand\tvideos\tthat\twill\tappear\ton\tthe\tpage. Most\ttags\tenclose\tsome\tother\tcontent.\tTake\ta\tlook\tat\tthe\th1\theading\tyou\tincluded;\tits anatomy\tis\tshown\tin\tFigure\t2.10.","Figure\t2.10\t\tAnatomy\tof\ta\tsimple\tHTML\ttag HTML\tstands\tfor\t\u201chypertext\tmarkup\tlanguage.\u201d\tTags\tare\tused\tto\t\u201cmark\tup\u201d\tyour\tcontent, designating\ttheir\tpurpose\t\u2013\tsuch\tas\theadings,\tlist\titems,\tand\tlinks. The\tcontent\tenclosed\tby\ta\tset\tof\ttags\tcan\talso\tinclude\tother\tHTML.\tNotice,\tfor\texample, that\tthe\t<header>\ttags\tenclose\tthe\t<h1>\ttag\tshown\tabove\t(and\tthe\t<body>\ttags\tenclose\tthe <header>!). There\tare\ta\tlot\tof\ttags\tto\tchoose\tfrom\t\u2013\tmore\tthan\t140.\tTo\tsee\ta\tlist\tof\tthem,\tvisit\tMDN\u2019s HTML\telement\treference,\tlocated\tat\tdeveloper.mozilla.org\/e\u200b n-US\/\u200bdocs\/\u200b Web\/\u200bHTML\/E\u200b lement.\tThis\treference\tincludes\ta\tbrief\tdescription\tof\teach\telement\tand groups\telements\tby\tusage\t(e.g.,\ttext\tcontent,\tcontent\tsectioning,\tor\tmultimedia). Linking\ta\tstylesheet In\tChapter\t3,\tyou\twill\twrite\tstyling\trules\tin\tyour\tstylesheet,\tstyles.css.\tBut\tremember the\tconversation\tbetween\tthe\tbrowser\tand\tthe\tserver\tat\tthe\tbeginning\tof\tthis\tchapter?\tThe browser\tonly\tknows\tto\task\tfor\ta\tfile\tfrom\tthe\tserver\tif\tit\thas\tbeen\ttold\tthat\tthe\tfile\texists. You\thave\tto\tlink\tto\tyour\tstylesheet\tso\tthat\tthe\tbrowser\tknows\tto\task\tfor\tit.\tUpdate\tthe head\tof\tindex.html\twith\ta\tlink\tto\tyour\tstyles.css\tfile. <!doctype\thtml> <html> \t\t<head> \t\t\t\t<meta\tcharset=\\\"utf-8\\\"> \t\t\t\t<title>ottergram<\/title> \t\t\t\t<link\trel=\\\"stylesheet\\\"\thref=\\\"stylesheets\/styles.css\\\"> \t\t<\/head> \t\t<body> ... The\t<link>\ttag\tis\thow\tyou\tattach\tan\texternal\tstylesheet\tto\tan\tHTML\tdocument.\tIt\thas\ttwo attributes,\twhich\tgive\tthe\tbrowser\tmore\tinformation\tabout\tthe\ttag\u2019s\tpurpose\t(Figure\t2.11). (The\torder\tof\tHTML\tattributes\tdoes\tnot\tmatter.)","Figure\t2.11\t\tAnatomy\tof\ta\ttag\twith\tattributes You\tset\tthe\trel\t(or\t\u201crelationship\u201d)\tattribute\tto\t\\\"stylesheet\\\",\twhich\tlets\tthe\tbrowser know\tthat\tthe\tlinked\tdocument\tprovides\tstyling\tinformation.\tThe\thref\tattribute\ttells\tthe browser\tto\tsend\ta\trequest\tto\tthe\tserver\tfor\tthe\tstyles.css\tfile\tlocated\tin\tthe\tstylesheets folder.\tNote\tthat\tthis\tfile\tpath\tis\trelative\tto\tthe\tcurrent\tdocument. Save\tindex.html\tbefore\tyou\tmove\ton. Adding\tcontent A\tweb\tpage\twithout\tcontent\tis\tlike\ta\tday\twithout\tcoffee.\tAdd\ta\tlist\tafter\tyour\theader\tto give\tyour\tproject\ta\treason\tfor\tliving. You\tare\tgoing\tto\tadd\tan\tunordered\tlist\t(that\tis,\ta\tbulleted\tlist)\tusing\tthe\t<ul>\ttag.\tIn\tthe list,\tyou\twill\tinclude\tfive\tlist\titems\tusing\t<li>\ttags,\tand\tin\teach\tlist\titem\tyou\twill\tinclude some\ttext\tsurrounded\tby\t<span>\ttags. The\tupdated\tindex.html\tis\tshown\tbelow.\tNote\tthat\tthroughout\tthis\tbook\twe\tshow\tnew code\tthat\tyou\tare\tadding\tin\tbold\ttype.\tCode\tthat\tyou\tare\tto\tdelete\tis\tshown\tstruck\tthrough. Existing\tcode\tis\tshown\tin\tplain\ttext\tto\thelp\tyou\tposition\tyour\tchanges\twithin\tthe\tfile. We\tencourage\tyou\tto\tmake\tuse\tof\tAtom\u2019s\tautocompletion\tand\tautoformatting\tfeatures. With\tyour\tcursor\tin\tposition,\ttype\t\u201cul\u201d\tand\tpress\tReturn.\tNext,\ttype\t\u201cli\u201d\tand\tpress\tReturn twice,\tthen\ttype\t\u201cspan\u201d\tand\tpress\tReturn\tonce.\tEnter\tthe\tname\tof\tan\totter,\tthen\tcreate\tfour more\tlist\titems\tand\tspans\tin\tthe\tsame\tway. <!doctype\thtml> <html> \t\t<head> \t\t\t\t<meta\tcharset=\\\"utf-8\\\"> \t\t\t\t<title>ottergram<\/title> \t\t\t\t<link\trel=\\\"stylesheet\\\"\thref=\\\"stylesheets\/styles.css\\\"> \t\t<\/head> \t\t<body> \t\t\t\t<header> \t\t\t\t\t\t<h1>ottergram<\/h1> \t\t\t\t<\/header> \t\t\t\t<ul> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<span>Barry<\/span> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<span>Robin<\/span> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<span>Maurice<\/span> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<span>Lesley<\/span> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<span>Barbara<\/span> \t\t\t\t\t\t<\/li> \t\t\t\t<\/ul> \t\t<\/body> <\/html>","The\t<span>\ttags\tnested\tinside\teach\t<li>\ttag\tdo\tnot\thave\tany\tspecial\tmeaning.\tThey\tare generic\tcontainers\tfor\tother\tcontent.\tYou\twill\tbe\tusing\tthem\tin\tOttergram\tfor\tstyling purposes,\tand\tyou\twill\tsee\tother\texamples\tof\tcontainer\telements\tas\tyou\tcontinue\tthrough this\tbook. Next,\tyou\twill\tadd\timages\tof\totters\tto\tgo\twith\tthe\tnames\tyou\thave\tentered. Adding\timages The\tresource\tfiles\tfor\tall\tthe\tprojects\tin\tthis\tbook\tare\tat\twww.bignerdranch.com\/\u200b downloads\/f\u200b ront-end-dev-resources.zip.\tThey\tinclude\tfive\tCreative Commons-licensed\totter\timages\ttaken\tby\tMichael\tL.\tBaird,\tJoe\tRobertson,\tand\tAgunther that\twere\tfound\ton\tcommons.wikimedia.org. Download\tand\tunzip\tthe\tresources.\tInside\tthe\tottergram-resources\tfolder,\tlocate the\timg\tfolder.\tCopy\tthe\timg\tfolder\tto\tyour\tottergram\/\tproject\tdirectory.\t(The\t.zip contains\tother\tresources,\tbut\tfor\tnow\tyou\twill\tonly\tneed\tthe\timg\tfolder.) You\twant\tyour\tlist\tto\tinclude\tclickable\tthumbnail\timages\tin\taddition\tto\tthe\ttitles.\tYou\twill achieve\tthis\tby\tadding\tanchor\tand\timage\ttags\tto\teach\titem\tin\tyour\tul.\tWe\twill\texplain these\tchanges\tin\tmore\tdetail\tafter\tyou\tenter\tthem.\t(If\tyou\tuse\tautocompletion,\tnote\tthat you\twill\tneed\tto\tmove\tthe\t<\/a>\ttags\tso\tthat\tthey\tfollow\tthe\tspans.) ... \t\t\t\t<ul> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter1.jpg\\\"\talt=\\\"Barry\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Barry<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter2.jpg\\\"\talt=\\\"Robin\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Robin<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter3.jpg\\\"\talt=\\\"Maurice\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Maurice<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter4.jpg\\\"\talt=\\\"Lesley\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Lesley<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter5.jpg\\\"\talt=\\\"Barbara\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Barbara<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t<\/ul> ... If\tyour\tlines\tare\tnot\tnicely\tindented,\tyou\tcan\ttake\tadvantage\tof\tthe\tatom-beautify\tplug-in\tthat you\tinstalled.\tClick\tPackages\t\u2192\tAtom\tBeautify\t\u2192\tBeautify\tand\tyour\tcode\twill\tbe\taligned\tand indented\tfor\tyou. Let\u2019s\tlook\tat\twhat\tyou\thave\tadded. The\t<a>\ttag\tis\tthe\tanchor\ttag.\tAnchor\ttags\tmake\telements\ton\tthe\tpage\tclickable,\tso\tthat they\ttake\tthe\tuser\tto\tanother\tpage.\tThey\tare\tcommonly\treferred\tto\tas\t\u201clinks,\u201d\tbut\tbeware: They\tare\tnot\tlike\tthe\t<link>\ttag\tyou\tused\tearlier.","Anchor\ttags\thave\tan\thref\tattribute,\twhich\tindicates\tthe\tresource\tthe\tanchor\tpoints\tto. Usually\tthe\tvalue\tis\ta\tweb\taddress.\tSometimes,\tthough,\tyou\tdo\tnot\twant\ta\tlink\tto\tgo anywhere.\tThat\tis\tthe\tcase\tfor\tnow,\tso\tyou\tassigned\tthe\t\u201cdummy\u201d\tvalue\t#\tto\tthe\thref attributes.\tThis\twill\tmake\tthe\tbrowser\tscroll\tto\tthe\ttop\tof\tthe\tpage\twhen\tthe\timage\tis clicked.\tLater\tyou\twill\tuse\tthe\tanchor\ttags\tto\topen\ta\tlarger\tcopy\tof\tan\timage\twhen\tthe thumbnail\tis\tclicked. Inside\tthe\tanchor\ttags\tyou\tadded\t<img>,\tor\timage,\ttags\twith\tsrc\tattributes\tindicating filenames\tin\tthe\timg\tdirectory\tyou\tadded\tearlier.\tYou\talso\tadded\ta\tdescriptive\talt attribute\tto\tyour\timage\ttags.\talt\tattributes\tcontain\ttext\tthat\treplaces\tthe\timage\tif\tit\tis unable\tto\tload.\talt\ttext\tis\talso\twhat\tscreen\treaders\tuse\tto\tdescribe\tan\timage\tto\ta\tuser\twith a\tvisual\timpairment. Image\ttags\tare\tdifferent\tfrom\tmost\tother\telements\tin\tthat\tthey\tdo\tnot\twrap\tother\telements, but\tinstead\trefer\tto\ta\tresource.\tWhen\tthe\tbrowser\tencounters\tan\t<img>\ttag,\tit\tdraws\tthe image\tto\tthe\tpage.\tThis\tis\tknown\tas\ta\treplaced\telement.\tOther\treplaced\telements\tinclude embedded\tdocuments\tand\tapplets. Because\tthey\tdo\tnot\twrap\tcontent\tor\tother\telements,\t<img>\ttags\tdo\tnot\thave\ta corresponding\tclosing\ttag.\tThis\tmakes\tthem\tself-closing\ttags\t(also\tknown\tas\tvoid\ttags). You\twill\tsometimes\tsee\tself-closing\ttags\twritten\twith\ta\tslash\tbefore\tthe\tright\tangle- bracket,\tlike\t<img\tsrc=\\\"otter.jpg\\\"\/>.\tWhether\tto\tinclude\tthe\tslash\tis\ta\tmatter\tof preference\tand\tdoes\tnot\tmake\ta\tdifference\tto\tthe\tbrowser.\tIn\tthis\tbook,\tself-closing\ttags are\twritten\twithout\tthe\tslash. Save\tindex.html.\tIn\ta\tmoment,\tyou\twill\tsee\tthe\tresults\tof\tyour\tcoding.","Viewing\tthe\tWeb\tPage\tin\tthe\tBrowser To\tview\tyour\tweb\tpage,\tyou\tneed\tto\tbe\trunning\tthe\tbrowser-sync\ttool\tthat\tyou\tinstalled in\tChapter\t1. Open\tthe\tterminal\tand\tchange\tdirectory\tto\tyour\tottergram\tfolder.\tRecall\tfrom Chapter\t1\tthat\tyou\tchange\tdirectory\tusing\tthe\tcd\tcommand\tfollowed\tby\tthe\tpath\tof\tthe folder\tyou\tare\tmoving\tinto.\tOne\teasy\tway\tto\tget\tthe\tottergram\tpath\tis\tto\tControl-click (right-click)\tthe\tottergram\tfolder\tin\tAtom\u2019s\tlefthand\tpanel\tand\tchoose\tCopy\tFull\tPath (Figure\t2.12).\tThen,\tat\tthe\tcommand\tline,\ttype\tcd,\tpaste\tthe\tpath,\tand\tpress\tReturn. Figure\t2.12\t\tCopying\tthe\tottergram\tfolder\tpath\tfrom\tAtom The\tpath\tyou\tenter\tmight\tlook\tsomething\tlike\tthis: cd\t\/Users\/chrisaquino\/Projects\/front-end-dev-book\/ottergram Once\tyou\tare\tin\tthe\tottergram\tdirectory,\trun\tthe\tfollowing\tcommand\tto\topen Ottergram\tin\tChrome.\t(We\thave\tbroken\tthe\tcommand\tacross\ttwo\tlines\tso\tthat\tit\tfits\ton\tthe page.\tYou\tshould\tenter\tit\ton\ta\tsingle\tline.) browser-sync\tstart\t--server\t--browser\t\\\"Google\tChrome\\\" \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t--files\t\\\"stylesheets\/*.css,\t*.html\\\" If\tChrome\tis\tyour\tdefault\tbrowser,\tyou\tcan\tleave\tout\tthe\t--browser\t\\\"Google\tChrome\\\" portion\tof\tthe\tcommand: browser-sync\tstart\t--server\t--files\t\\\"stylesheets\/*.css,\t*.html\\\" This\tcommand\tstarts\tbrowser-sync\tin\tserver\tmode,\tallowing\tit\tto\tsend\tresponses\twhen\ta browser\tsends\ta\trequest\tto\tget\ta\tfile,\tsuch\tas\tthe\tindex.html\tfile\tyou\tcreated. The\tcommand\tyou\tentered\talso\ttells\tbrowser-sync\tto\tautomatically\treload\tthe\tbrowser\tif","any\tHTML\tor\tCSS\tfiles\tare\tchanged.\tThis\tmakes\tthe\tdevelopment\texperience\tmuch\tnicer. Before\ttools\tlike\tbrowser-sync,\tyou\thad\tto\tmanually\treload\tthe\tpage\tafter\tevery\tchange. Figure\t2.13\tshows\tthe\tresult\tof\tentering\tthis\tcommand\ton\ta\tMac. Figure\t2.13\t\tStarting\tbrowser-sync\tin\tthe\tOS\tX\tTerminal You\tshould\tsee\tthe\tsame\toutput\ton\tWindows\t(Figure\t2.14).","Figure\t2.14\t\tStarting\tbrowser-sync\tin\tthe\tWindows\tCommand\tPrompt Once\tthe\tOttergram\tpage\thas\tloaded\tin\tChrome,\tyou\tshould\tsee\tyour\tpage\twith\tthe \u201cottergram\u201d\theading,\t\u201cottergram\u201d\tas\tthe\ttab\tlabel,\tand\ta\tseries\tof\totter\tphotos\tand\tnames (Figure\t2.15).","Figure\t2.15\t\tViewing\tOttergram\tin\tthe\tbrowser","The\tChrome\tDeveloper\tTools Chrome\thas\tbuilt-in\tDeveloper\tTools\t(commonly\tknown\tas\t\u201cDevTools\u201d)\tthat\tare\tamong\tthe best\tavailable\tfor\ttesting\tstyles,\tlayouts,\tand\tmore\ton\tthe\tfly.\tUsing\tthe\tDevTools\tis\tmuch more\tefficient\tthan\ttrying\tthings\tout\tin\tcode.\tThe\tDevTools\tare\tvery\tpowerful\tand\twill\tbe your\tconstant\tcompanion\tas\tyou\tdo\tfront-end\tdevelopment. You\twill\tstart\tusing\tthe\tDevTools\tin\tthe\tnext\tchapter.\tFor\tnow,\topen\tthe\twindow\tand familiarize\tyourself\twith\tits\tmajor\tareas. To\topen\tthe\tDevTools,\tclick\tthe\t \ticon\tto\tthe\tright\tof\tthe\taddress\tbar\tin\tChrome.\tNext, click\tMore\tTools\t\u2192\tDeveloper\tTools\t(Figure\t2.16). Figure\t2.16\t\tOpening\tthe\tDeveloper\tTools Chrome\tdisplays\tthe\tDevTools\tto\tthe\tright\tby\tdefault.\tYour\tscreen\twill\tlook\tsomething\tlike Figure\t2.17.","Figure\t2.17\t\tThe\tDevTools\tshowing\tthe\telements\tpanel The\tDevTools\tshow\tthe\trelationship\tbetween\tthe\tcode\tand\tthe\tresulting\tpage\telements. They\tlet\tyou\tinspect\tindividual\telements\u2019\tattributes\tand\tstyles\tand\tsee\timmediately\thow the\tbrowser\tis\tinterpreting\tyour\tcode.\tSeeing\tthis\trelationship\tis\tcritical\tfor\tboth development\tand\tdebugging. In\tFigure\t2.17,\tyou\tcan\tsee\tthe\tDevTools\tnext\tto\tthe\tweb\tpage,\tdisplaying\tthe\telements panel.\tThe\telements\tpanel\tis\tdivided\tinto\ttwo\tsections.\tOn\tthe\tleft\tis\tthe\tDOM\ttree\tview. This\tis\ta\trepresentation\tof\tthe\tHTML,\tinterpreted\tas\tDOM\telements.\t(You\twill\tlearn\tmuch more\tabout\tDOM,\twhich\tstands\tfor\t\u201cdocument\tobject\tmodel,\u201d\tin\tupcoming\tchapters.)\tOn the\trighthand\tside\tof\tthe\telements\tpanel\tis\tthe\tstyles\tpane.\tThis\tshows\tany\tvisual\tstyles applied\tto\tindividual\telements. Having\tthe\tDevTools\tdocked\ton\tthe\tright\tside\tof\tthe\tscreen\twhile\tyou\tare\tworking\tis usually\tconvenient.\tIf\tyou\twant\tto\tchange\tthe\tlocation\tof\tthe\tDevTools,\tyou\tcan\tclick\tthe\t \tbutton\tnear\tthe\tupper-right\tcorner.\tThis\twill\tshow\tyou\ta\tmenu\tof\toptions,\tincluding buttons\tfor\tthe\tDock\tside,\twhich\twill\tchange\tthe\tanchor\tlocation\tof\tthe\tDevTools (Figure\t2.18).","Figure\t2.18\t\tChanging\tthe\tdock\tside\tof\tthe\tDevTools With\tyour\totters\tand\tmarkup\tin\tplace\tand\tthe\tDevTools\topen,\tyou\tare\tready\tto\tbegin styling\tyour\tproject\tin\tthe\tnext\tchapter.","For\tthe\tMore\tCurious:\tCSS\tVersions The\tversion\thistory\tof\tCSS\tincludes\tstandard\tversions\t1,\t2,\tand\t2.1.\tAfter\t2.1,\tit\twas decided\tthat\tthe\tstandard\tneeded\tto\tbe\tbroken\tup\tbecause\tit\twas\tgetting\ttoo\tbig. There\tis\tno\tversion\t3.\tInstead,\tCSS3\tis\ta\tblanket\tterm\tfor\ta\tnumber\tof\tmodules,\teach\twith its\town\tversion\tnumber. Table\t2.1\t\tCSS\tversions,\treal\tand\timagined Version Release Notable\tFeatures Number Year 1 1996 Basic\tfont\tproperties\t(font-family,\tfont-style),\tforeground\tand background\tcolors,\ttext\talignment,\tmargin,\tborder,\tand\tpadding. 2 1998 Absolute,\trelative,\tand\tfixed\tpositioning;\tnew\tfont\tproperties. 2.1 2011 Removed\tfeatures\tthat\twere\tpoorly\tsupported\tby\tbrowsers. \u201c3\u201d Various A\tcollection\tof\tdifferent\tspecifications,\tsuch\tas\tmedia\tqueries,\tnew selectors,\tsemi-transparent\tcolors,\t@font-face.","For\tthe\tMore\tCurious:\tThe\tfavicon.ico Have\tyou\tever\tnoticed\tthe\tlittle\ticon\tthat\tappears\tat\tthe\tleft\tend\tof\tyour\tbrowser\u2019s\taddress bar\twhen\tyou\tvisit\tmost\twebsites?\tSometimes\tthey\talso\tappear\tin\tyour\tbrowser\ttab,\tas\tin Figure\t2.19. Figure\t2.19\t\tThe\tbignerdranch.com\tfavicon.ico That\tis\tthe\tfavicon.ico\timage\tfile.\tMany\tsites\thave\tone,\tand\tbrowsers\trequest\tone\tby default.\tBecause\tOttergram\tdoes\tnot\thave\tone,\tyou\tmay\tsee\tan\terror\tlike\tthe\tone\tin Figure\t2.20\tin\tthe\tDevTools. Figure\t2.20\t\tError\tabout\tmissing\tfavicon.ico Do\tnot\tworry\tabout\tthis\terror\tif\tit\tappears.\tIt\twill\tnot\taffect\tyour\tproject.\tHowever,\tyou can\teasily\tadd\ta\tfavicon.ico\timage\t\u2013\tand\tthat\tis\tyour\tfirst\tchallenge.","Silver\tChallenge:\tAdding\ta\tfavicon.ico You\thave\tdecided\tthat\tyou\tlike\totters\tmore\tthan\tyou\tlike\tseeing\tthe\tfavicon.ico\terror message.\tYou\tare\tgoing\tto\tcreate\ta\tfavicon.ico\tfile\tusing\tone\tof\tthe\totter\timages. Do\ta\tweb\tsearch\tfor\t\u201cfavicon\tgenerator\u201d\tand\tyou\tshould\tsee\ta\tlist\tof\twebsites\tthat\twill\tdo a\tfile\tconversion\tfor\tyou.\tMost\twill\tlet\tyou\tupload\tan\timage\tand\tthen\tprovide\tyou\twith\ta favicon.ico\tversion. Choose\tone\tand\tupload\tany\tone\tof\tthe\totter\timages. Save\tthe\tresulting\tfavicon.ico\tfile\tin\tthe\tsame\tfolder\tas\tyour\tindex.html\tfile. Finally,\treload\tyour\tbrowser.\tYour\tbrowser\ttab\twill\tlook\tsomething\tlike\tFigure\t2.21. Figure\t2.21\t\tOttergram\twith\ta\tfavicon.ico","3\t Styles In\tthis\tchapter,\tyou\twill\tdesign\ta\tstatic\tversion\tof\tOttergram.\tIn\tthe\tchapters\tthat\tfollow, you\twill\tmake\tOttergram\tinteractive. When\tyou\treach\tthe\tend\tof\tthis\tchapter,\tyour\twebsite\twill\tlook\tlike\tFigure\t3.1. Figure\t3.1\t\tOttergram:\tstylish This\tchapter\tintroduces\ta\tnumber\tof\tconcepts\tand\texamples.\tDo\tnot\tworry\tif\tyou\tdo\tnot feel\tthat\tyou\thave\tmastered\tall\tof\tthem\twhen\tyou\tget\tto\tthe\tend.\tYou\twill\tbe\tencountering them\tagain\tand\tagain\tas\tyou\tprogress\tthrough\tthis\tbook,\tand\tyour\twork\tin\tthis\tchapter\twill","provide\ta\tsolid\tfoundation\ton\twhich\tyou\twill\tbuild\ttrue\tunderstanding. Of\tcourse,\twe\tcan\tonly\tintroduce\tyou\tto\ta\ttiny\tfraction\tof\tall\tthe\tstyles\tthat\tare\tavailable\tin CSS.\tYou\twill\twant\tto\tconsult\tthe\tMDN\tfor\tinformation\tabout\tthe\tfull\tset\tof\tproperties and\ttheir\tvalues. Front-end\tdevelopers\thave\tto\tchoose\tbetween\ttwo\tapproaches\tto\tstyling\ta\twebsite:\tstart with\tthe\toverall\tlayout\tand\twork\tdown\tto\tthe\tsmallest\tdetails,\tor\tstart\twith\tthe\tsmallest details\tand\twork\tup\tto\tthe\toverall\tlayout. Not\tonly\tdoes\tworking\tfrom\tdetail\tto\tbig\tpicture\tproduce\tcleaner,\tmore\treusable\tcode,\tit also\thas\ta\tcool\tname:\tatomic\tstyling.\tYou\twill\tuse\tthis\tapproach\tas\tyou\tstyle\tthe\totter thumbnails\tfirst,\tthen\tthe\tthumbnail\tlist\tlayout.\tIn\tthe\tnext\tchapter,\tyou\twill\twork\ton\tthe layout\tof\tthe\tsite\tas\ta\twhole. Creating\ta\tStyling\tBaseline You\tare\tgoing\tto\tbegin\tby\tadding\tthe\tnormalize.css\tfile\tto\tyour\tproject. normalize.css\thelps\tthe\tCSS\tyou\twrite\tdisplay\tconsistently\tacross\tbrowsers.\tAll browsers\tcome\twith\ta\tset\tof\tdefault\tstyles,\tbut\tthe\tdefaults\tare\tdifferent\tfrom\tbrowser\tto browser.\tnormalize.css\tgives\tyou\ta\tgood\tstarting\tpoint\tfor\tdeveloping\tyour\town custom\tCSS\tfor\ta\twebsite\tor\tweb\tapp. normalize.css\tis\tfreely\tavailable\tonline.\tYou\tdo\tnot\tneed\tto\tdownload\tit.\tTo\tadd\tit\tto Ottergram,\tyou\tonly\tneed\tto\tlink\tto\tit\tin\tindex.html. To\tensure\tthat\tyou\tare\tusing\tthe\tmost\tcurrent\tversion\tof\tnormalize.css,\tyou\tare going\tto\tget\tits\taddress\tfrom\ta\tcontent\tsharing\tsite.\tGo\tto\tcdnjs.com\/l\u200b ibraries\/\u200b normalize\tand\tfind\tthe\tversion\tof\tthe\tfile\tending\twith\t.min.css.\t(This\tversion\tis\ta smaller\tdownload\tthan\tthe\tothers,\twith\tthe\textra\twhitespace\tstripped\tout.)\tClick\tthe\tCopy button\tto\tcopy\tits\taddress\t(Figure\t3.2).","Figure\t3.2\t\tGetting\ta\tlink\tto\tnormalize.css\tfrom\tcdnjs.com The\tcurrent\tversion\tat\tthe\ttime\tof\tthis\twriting\tis\t3.0.3,\tbut\tthe\tversion\tyou\tuse\tmay\tbe more\trecent. Open\tyour\tOttergram\tfolder\tin\tAtom,\tthen\topen\tindex.html.\tAdd\ta\tnew\t<link>\ttag\tand paste\tin\tthe\taddress.\t(In\tthe\tcode\tbelow,\tthe\t<link>\thas\tbeen\tbroken\tinto\ttwo\tlines\tto\tfit on\tthe\tpage.\tYou\tcan\tleave\tyours\ton\ta\tsingle\tline.) <!doctype\thtml> <html> \t\t<head> \t\t\t\t<meta\tcharset=\\\"utf-8\\\"> \t\t\t\t<title>ottergram<\/title> \t\t\t\t<link\trel=\\\"stylesheet\\\" \t\t\t\t\t\thref=\\\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/normalize\/3.0.3\/normalize.min.css\\\"> \t\t\t\t<link\trel=\\\"stylesheet\\\"\thref=\\\"stylesheets\/styles.css\\\"> \t\t<\/head> ... Make\tsure\tthat\tyou\tadd\tthe\t<link>\ttag\tfor\tnormalize.css\tbefore\tthe\t<link>\ttag\tfor styles.css.\tThe\tbrowser\tneeds\tto\tread\tthe\tstyles\tfound\tin\tnormalize.css\tbefore\tit reads\tyours. And,\tjust\tlike\tthat,\tyour\tproject\tcan\ttake\tadvantage\tof\tthis\tuseful\ttool.\tNo\tother\tsetup\tis required. You\tmay\tbe\twondering\twhy\tyou\tare\tlinking\tto\tan\taddress\ton\ta\tcompletely\tdifferent\tserver. In\tfact,\tit\tis\tnot\tunusual\tfor\tan\tHTML\tfile\tto\tspecify\tresources\tlocated\ton\tdifferent\tservers (Figure\t3.3).","Figure\t3.3\t\tRequesting\tresources\tfrom\tdifferent\tservers In\tthis\tcase,\tnormalize.css\tis\thosted\ton\tcdnjs.com,\ta\tpublic\tserver\tthat\tis\tpart\tof\ta content\tdelivery\tnetwork,\tor\tCDN.\tCDNs\thave\tservers\tall\taround\tthe\tworld,\teach\twith copies\tof\tthe\tsame\tfiles.\tWhen\tusers\trequest\ta\tfile,\tthey\treceive\tit\tfrom\ta\tserver\tnearby, cutting\tdown\ton\tthe\tload\ttime\tfor\tthat\tfile.\tcdnjs.com\thosts\tmany\tversions\tof\tpopular front-end\tlibraries\tand\tframeworks.","Preparing\tthe\tHTML\tfor\tStyling In\tthe\tlast\tchapter,\tyou\tcreated\ta\tstylesheet\tcalled\tstyles.css,\tand\tin\tthis\tchapter\tyou will\tadd\ta\tnumber\tof\tCSS\tstyling\trules\tto\tit.\tBut\tbefore\tyou\tget\tstarted\tadding\tstyles,\tyou need\tto\tset\tup\tyour\tHTML\twith\ttargets\tfor\tyour\tstyling\trules\tto\trefer\tto. You\tare\tgoing\tto\tadd\tclass\tattributes\tidentifying\tthe\tspan\telements\twith\tthe\totters\u2019\tnames as\t\u201cthumbnail\ttitles.\u201d\tclass\tattributes\tare\ta\tway\tto\tidentify\ta\tgroup\tof\tHTML\telements, usually\tfor\tstyling.\tYour\t\u201cthumbnail\ttitle\u201d\tclass\twill\tallow\tyou\tto\teasily\tstyle\tall\tthe names\tat\tonce. In\tindex.html,\tadd\tthe\tclass\tname\tthumbnail-title\tas\tan\tattribute\tof\tthe\tspans\tinside the\tli\telements,\tas\tshown: ... \t\t\t\t<ul> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter1.jpg\\\"\talt=\\\"Barry\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Barry<\/span> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Barry<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter2.jpg\\\"\talt=\\\"Robin\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Robin<\/span> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Robin<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter1.jpg\\\"\talt=\\\"Maurice\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Maurice<\/span> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Maurice<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter4.jpg\\\"\talt=\\\"Lesley\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Lesley<\/span> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Lesley<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter5.jpg\\\"\talt=\\\"Barbara\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span>Barbara<\/span> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Barbara<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t<\/ul> ... In\ta\tmoment,\tyou\twill\tuse\tthis\tclass\tname\tto\tstyle\tall\tthe\timage\ttitles.","Anatomy\tof\ta\tStyle When\tyou\tcreate\tindividual\tstyles,\tyou\tdo\tso\tby\twriting\tstyling\trules,\twhich\tconsist\tof\ttwo main\tparts:\tselectors\tand\tdeclarations\t(Figure\t3.4). Figure\t3.4\t\tAnatomy\tof\ta\tstyling\trule The\tfirst\tpart\tof\ta\tstyling\trule\tis\tone\tor\tmore\tselectors.\tSelectors\tdescribe\tthe\telements\tthat the\tstyle\tshould\tbe\tapplied\tto,\tlike\th1,\tspan,\tor\timg.\tBut\tselectors\tare\tnot\tlimited\tto\ttag names.\tYou\tcan\twrite\tselectors\tthat\tapply\tto\ta\tmore\ttargeted\tset\tof\telements\tby\tincreasing the\tselector\u2019s\tspecificity. For\texample,\tyou\tcan\twrite\tselectors\tbased\ton\tattributes\t\u2013\tsuch\tas\tthe\tthumbnail-title class\tattribute\tyou\tjust\tadded\tto\tthe\t<span>\ttags.\tSelectors\tbased\ton\tattributes\tare\tmore specific\tthan\tselectors\tbased\ton\telement\tnames. In\taddition\tto\tmaking\tsure\tthat\tstyles\tare\tonly\tapplied\tto\ta\tlimited\tset\tof\telements\t(e.g., elements\twith\tthe\tclass\tname\tthumbnail-title\tversus\tall\t<span>\telements),\tspecificity also\tdetermines\tthe\tselector\u2019s\trelative\tpriority.\tIf\ta\tstylesheet\tcontains\tmultiple\tstyles\tthat could\tapply\tto\tthe\tsame\telement,\tthe\tstyles\twith\ta\tselector\tof\thigher\tspecificity\twill\tbe used\tinstead\tstyles\twhose\tselector\thas\ta\tlower\tspecificity.\tYou\tcan\tread\tmore\tabout specificity\tin\ta\tFor\tthe\tMore\tCurious\tsection\tat\tthe\tend\tof\tthis\tchapter. Throughout\tthis\tchapter,\tyou\twill\tbe\tintroduced\tto\ta\tnumber\tof\tdifferent\tkinds\tof\tselectors that\tvary\tin\ttheir\tspecificity.\tThough\tthere\tare\toften\tmany\tways\tto\ttarget\tthe\tsame\telement for\tstyling,\tunderstanding\tspecificity\tis\tkey\tto\tchoosing\tthe\tbest\tselector\tto\tuse\tso\tthat your\tstyles\tare\tmaintainable. The\tsecond\tpart\tof\ta\tstyling\trule\tis\tthe\tdeclaration\tblock,\twrapped\tin\tcurly\tbraces,\twhich defines\tthe\tstyles\tto\tbe\tapplied.\tThe\tindividual\tdeclarations\twithin\tthe\tblock\teach\tinclude","a\tproperty\tname\tand\ta\tvalue\tfor\tthat\tproperty. In\tyour\tfirst\tstyling\trule,\tyou\twill\tuse\tthe\tclass\tattribute\tyou\tjust\tadded\tas\ta\tselector\tto apply\tstyles\taround\tthe\totters\u2019\tnames.","Your\tFirst\tStyling\tRule To\tuse\ta\tclass\tas\ta\tselector\tin\ta\tstyling\trule,\tyou\tprefix\tthe\tclass\tname\twith\ta\tdot\t(period), as\tin\t.thumbnail-title.\tThe\tfirst\tstyles\tyou\tare\tgoing\tto\tadd\twill\tset\tthe\tbackground\tand foreground\tcolors\tfor\tthe\t.thumbnail-title\tclass. Open\tstyles.css\tand\tadd\tyour\tstyling\trule: .thumbnail-title\t{ \t\tbackground:\trgb(96,\t125,\t139); \t\tcolor:\trgb(202,\t238,\t255); } You\twill\tlearn\tmore\tabout\tcolor\tlater\tin\tthis\tchapter.\tFor\tnow,\tjust\ttake\ta\tlook\tat\tyour changes.\tSave\tstyles.css\tand\tmake\tsure\tbrowser-sync\tis\trunning.\tIf\tyou\tneed\tto restart\tit,\tthe\tcommand\tis: browser-sync\tstart\t--server\t--browser\t\\\"Google\tChrome\\\" \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t--files\t\\\"stylesheets\/*.css,\t*.html\\\" This\twill\topen\tyour\tweb\tpage\tin\tChrome\t(Figure\t3.5).","Figure\t3.5\t\tA\tslightly\tmore\tcolorful\tOttergram You\tcan\tsee\tthat\tyou\thave\tset\tthe\tbackground\tfor\tthe\tthumbnail\ttitles\tto\ta\tdeep\tgray-blue","and\tthe\tfont\tcolor\tto\ta\tlighter\tblue.\tNice. Continue\tstyling\tthe\tthumbnail\ttitles:\tReturn\tto\tstyles.css\tand\tadd\tto\tyour\texisting styling\trule\tfor\tthe\t.thumbnail-title\tclass,\tas\tshown: .thumbnail-title\t{ \t\tdisplay:\tblock; \t\tmargin:\t0; \t\tpadding:\t4px\t10px; \t\tbackground:\trgb(96,\t125,\t139); \t\tcolor:\trgb(202,\t238,\t255); } The\tthree\tdeclarations\tyou\thave\tadded\tall\taffect\tan\telement\u2019s\tbox.\tFor\tevery\tHTML\ttag that\thas\ta\tvisual\trepresentation,\tthe\tbrowser\tdraws\ta\trectangle\tto\tthe\tpage.\tThe\tbrowser uses\ta\tscheme\tcalled\tthe\tstandard\tbox\tmodel\t(or\tjust\t\u201cbox\tmodel\u201d)\tto\tdetermine\tthe dimensions\tof\tthat\trectangle. The\tbox\tmodel To\tunderstand\tthe\tbox\tmodel,\tyou\tare\tgoing\tto\tlook\tat\tits\trepresentation\tin\tthe\tDevTools. Save\tstyles.css,\tswitch\tto\tChrome,\tand\tmake\tsure\tthe\tDevTools\tare\topen\t(Figure\t3.6). Figure\t3.6\t\tExploring\tthe\tbox\tmodel Click\tthe\t \tbutton\tin\tthe\tupper-left\tof\tthe\telements\tpanel.\tThis\tis\tthe\tInspect\tElement button.\tNow\tmove\tyour\tcursor\tover\tthe\tword\t\u201cottergram\u201d\ton\tthe\tweb\tpage.\tAs\tyou\thover over\tthe\tword,\tthe\tDevTools\tsurrounds\tthe\theading\twith\ta\tblue-\tand\tpeach-colored rectangle\t(Figure\t3.7).","Figure\t3.7\t\tHovering\tover\tthe\theading Click\tthe\tword\t\u201cottergram\u201d\ton\tthe\tweb\tpage.\tAlthough\tyou\tno\tlonger\tsee\tthe\tmulticolored overlay,\tthe\telement\tis\tnow\tselected\tand\tthe\tDOM\ttree\tview\tin\tthe\telements\tpanel\twill expand\tto\tshow\tand\thighlight\tthe\tcorresponding\t<h1>\ttag. The\trectangular\tdiagram\tin\tthe\tlower-right\tof\tthe\telements\tpanel\trepresents\tthe\tbox\tmodel for\tthe\th1\telement.\tYou\tcan\tsee\tthat\tthe\tregions\tof\tthe\tdiagram\thave\tsome\tof\tthe\tsame colors\tas\tthe\trectangle\tyou\tsaw\toverlaying\tthe\theading\twhen\tyou\tinspected\tit\t(Figure\t3.8). Figure\t3.8\t\tViewing\tthe\tbox\tmodel\tfor\tan\telement The\tbox\tmodel\tincorporates\tfour\taspects\tof\tthe\trectangle\tdrawn\tfor\tan\telement\t(which\tthe DevTools\trenders\tin\tfour\tdifferent\tcolors\tin\tthe\tdiagram). content\t(shown\tin\tblue) the\tvisual\tcontent\t\u2013\there,\tthe\ttext padding\t(shown\tin\tgreen) transparent\tspace\taround\tthe\tcontent border\t(shown\tin\tyellow) a\tborder,\twhich\tcan\tbe\tmade\tvisible,\taround\tthe\tcontent\tand\tpadding margin\t(shown\tin\tpeach) transparent\tspace\taround\tthe\tborder The\tnumbers\tin\tFigure\t3.8\tare\tpixel\tvalues;\ta\tpixel\tis\ta\tunit\tcorresponding\tto\tthe\tsmallest","rectangular\tarea\tof\ta\tcomputer\tscreen\tthat\tcan\tdisplay\ta\tsingle\tcolor.\tIn\tthe\tcase\tof\tthe\th1 element,\tthe\tcontent\tarea\thas\tbeen\tallocated\tan\tarea\tof\t197\tpixels\tby\t54\tpixels\t(your values\tmay\tbe\tdifferent,\tdepending\ton\tthe\tsize\tof\tyour\tbrowser\twindow).\tThere\tis\tpadding of\t40\tpixels\ton\tthe\tleft\tside.\tThe\tborder\tis\tset\tat\t0,\tand\tthere\tis\ta\tmargin\tof\t16\tpixels\tabove and\tbelow\tthe\telement. Where\tdid\tthat\tmargin\tvalue\tcome\tfrom?\tEach\tbrowser\tprovides\ta\tdefault\tstylesheet, called\tthe\tuser\tagent\tstylesheet,\tin\tcase\tan\tHTML\tfile\tdoes\tnot\tspecify\tone.\tStyles\tthat you\tspecify\toverride\tthe\tdefaults.\tBecause\tyou\thave\tnot\tspecified\tvalues\tfor\tthe\th1 element\u2019s\tbox,\tthe\tdefault\tstyles\thave\tbeen\tapplied. Now\tyou\tare\tready\tto\tunderstand\tthe\tstyling\tdeclarations\tyou\tadded: .thumbnail-title\t{ \t\tdisplay:\tblock; \t\tmargin:\t0; \t\tpadding:\t4px\t10px; \t\tbackground:\trgb(96,\t125,\t139); \t\tcolor:\trgb(202,\t238,\t255); } The\tdisplay:\tblock\tdeclaration\tchanges\tthe\tbox\tfor\tall\telements\tof\tthe\tclass .thumbnail-title\tso\tthat\tthey\toccupy\tthe\tentire\twidth\tallowed\tby\ttheir\tcontaining element.\t(Notice\tin\tFigure\t3.6\tthat\tthe\tbackground\tcolor\tfor\tthe\ttitles\tnow\tcovers\ta\twider area.)\tOther\tdisplay\tvalues,\tsuch\tas\tthe\tdisplay:\tinline\tproperty\tyou\twill\tsee\tlater, make\tan\telement\u2019s\twidth\tfit\tto\tits\tcontent. You\talso\tset\tthe\tmargin\tfor\tthe\tthumbnail\ttitles\tto\t0\tand\tthe\tpadding\tto\ttwo\tdifferent values:\t4px\tand\t10px\t(px\tis\tthe\tabbreviation\tfor\t\u201cpixels\u201d).\tThis\tsets\tthe\tpadding\tto\tspecific pixel\tvalues,\toverriding\tthe\tdefault\tsize\tset\tby\tthe\tuser\tagent\tstylesheet. Padding,\tmargin,\tand\tcertain\tother\tstyles\tcan\tbe\twritten\tas\tshorthand\tproperties,\tin\twhich one\tvalue\tis\tapplied\tto\tmultiple\tproperties.\tYou\tare\ttaking\tadvantage\tof\tthis\there:\tWhen two\tvalues\tare\tprovided\tfor\tthe\tpadding,\tthe\tfirst\tis\tapplied\tto\tboth\tvertical\tvalues\t(top\tand bottom)\tand\tthe\tsecond\tis\tapplied\tto\tboth\thorizontal\tvalues\t(left\tand\tright).\tIt\tis\talso possible\tto\tprovide\ta\tsingle\tvalue\tto\tbe\tapplied\tto\tall\tfour\tsides\tor\tto\tspecify\ta\tseparate value\tfor\teach\tside. To\tsum\tup,\tyour\tnew\tdeclarations\tsay\tthat\tthe\tbox\tfor\tall\telements\tof\tthe\t.thumbnail- title\tclass\twill\tfill\tthe\twidth\tof\tits\tcontainer\twith\tno\tmargin\tand\twith\tpadding\tthat\tis\t4 pixels\tat\tthe\ttop\tand\tbottom\tand\t10\tpixels\tat\tthe\tleft\tand\tright\tsides.","Style\tInheritance Next,\tyou\tare\tgoing\tto\tadd\tstyles\tto\tchange\tthe\tsize\tand\tappearance\tof\tthe\ttext. Add\ta\tnew\tstyling\trule\tin\tstyles.css\tto\tset\tthe\tfont\tsize\tfor\tthe\tbody\telement.\tTo\tdo this,\tyou\twill\tuse\ta\tdifferent\ttype\tof\tselector\t\u2013\tan\telement\tselector\t\u2013\tby\tsimply\tusing\tthe element\u2019s\tname. body\t{ \t\tfont-size:\t10px; } .thumbnail-title\t{ \t\tdisplay:\tblock; \t\tmargin:\t0; \t\tpadding:\t4px\t10px; \t\tbackground:\trgb(96,\t125,\t139); \t\tcolor:\trgb(202,\t238,\t255); } This\tstyling\trule\tsets\tthe\tbody\telement\u2019s\tfont-size\tto\t10px. You\twill\trarely\tuse\telement\tselectors\tin\tyour\tstylesheets,\tbecause\tyou\twill\tnot\toften\twant to\tapply\tthe\texact\tsame\tstyles\tto\tevery\toccurrence\tof\ta\tparticular\ttag.\tAlso,\telement selectors\tlimit\tyour\tability\tto\treuse\tstyles;\tusing\tthem\tmeans\tthat\tyou\tmay\tend\tup\tretyping the\tsame\tdeclarations\tthroughout\tyour\tstylesheets.\tThis\tis\tnot\tgreat\tfor\tmaintenance\tif\tyou need\tto\talter\tthose\tstyles. But,\tin\tthis\tcase,\ttargeting\tthe\tbody\telement\tis\texactly\tthe\tright\tamount\tof\tspecificity. There\tcan\tbe\tonly\tone\t<body>\telement,\tand\tyou\twill\tnot\tbe\treusing\tits\tstyles. Save\tstyles.css\tand\tcheck\tout\tyour\tweb\tpage\tin\tChrome\t(Figure\t3.9). Figure\t3.9\t\tAfter\tsetting\tthe\tbody\tfont\tsize Your\theadline\tand\tthumbnail\ttitles\thave\tgotten\tsmaller.\tYou\tmay\t\u2013\tor\tmay\tnot\t\u2013\thave expected\tthis.\tWhile\tthe\theadline\tis\tdirectly\twithin\tthe\tbody\telement\twhere\tyou\tdeclared","the\tfont-size\tproperty,\tthe\tthumbnail\ttitles\tare\tnot.\tThey\tare\tnested\tseveral\tlevels\tdeep. However,\tmany\tstyles,\tincluding\tfont\tsize,\tare\tapplied\tto\tthe\telements\tspecified\tby\tthe styling\trule\tas\twell\tas\tthe\tdescendants\tof\tthose\telements. The\tstructure\tof\tyour\tdocument\tcan\tbe\tdescribed\tusing\ta\ttree\tdiagram,\tas\tin\tFigure\t3.10. Representing\tyour\telements\tas\ta\ttree\tis\ta\tgood\tway\tto\tvisualize\tthe\tDOM. Figure\t3.10\t\tSimplified\tstructure\tof\tOttergram An\telement\tcontained\twithin\tanother\telement\tis\tsaid\tto\tbe\tits\tdescendent.\tIn\tthis\tcase, your\tspans\tare\tall\tdescendents\tof\tthe\tbody\t(as\twell\tas\tthe\tul\tand\ttheir\trespective\tli),\tso they\tinherit\tthe\tbody\u2019s\tfont-size\tstyle. In\tthe\tDevTools\u2019\tDOM\ttree\tview,\tlocate\tand\tselect\tone\tof\tthe\tspan\telements.\tIn\tthe\tstyles pane,\tnotice\tthe\tboxes\tlabeled\tInherited\tfrom\ta,\tInherited\tfrom\tli,\tand\tInherited\tfrom\tul.\tThese\tthree areas,\tas\tindicated,\tshow\tstyles\tinherited\tat\teach\tlevel\tfrom\tthe\tuser\tagent\tstylesheet. Under\tInherited\tfrom\tbody,\tyou\tcan\tsee\tthat\tthe\tfont-size\tproperty\thas\tbeen\tinherited\tfrom the\tstyle\tset\tfor\tthe\tbody\telement\tin\tstyles.css\t(Figure\t3.11).","Figure\t3.11\t\tStyles\tinherited\tfrom\tancestor\telements What\tif\ta\tdifferent\tfont\tsize\twere\tset\tat\tanother\tlevel,\tsuch\tas\tthe\tul?\tStyles\tfrom\tthe closer\tancestor\ttake\tpriority,\tso\ta\tfont\tsize\tset\tin\tstyles.css\tfor\tthe\tul\twould\toverride one\tset\tfor\tthe\tbody\tand\ta\tfont\tsize\tset\tfor\tthe\tspan\telement\titself\twould\toverride\tthem both. To\tsee\tthis,\tclick\ton\tthe\tul\telement\tin\tthe\tDOM\ttree\tview.\tThis\twill\tallow\tyou\tto\ttry\tout styles\ton\tthe\tfly.\tThe\tstyles\tyou\tadd\there\twill\tbe\timmediately\treflected\tin\tthe\tweb\tpage view,\tbut\twill\tnot\tbe\tadded\tto\tyour\tactual\tproject\tfiles. At\tthe\ttop\tof\tthe\tstyles\tpane\tin\tthe\telements\tpanel,\tyou\twill\tsee\ta\tsection\tlabeled elements.style.\tClick\tanywhere\tin\tbetween\tthe\tcurly\tbraces\tof\tthe\telements.style,\tand the\tDevTools\twill\tgive\tyou\ta\tprompt\t(Figure\t3.12).","Figure\t3.12\t\tPrompting\tfor\ta\tstyle\trule Start\ttyping\tfont-size,\tand\tthe\tDevTools\twill\tsuggest\tpossible\tcompletions\t(Figure\t3.13). Figure\t3.13\t\tAutocompletion\toptions\tin\tstyles\tpane Choose\tfont-size,\tthen\tpress\tthe\tTab\tkey.\tEnter\ta\tlarge\tvalue,\tsuch\tas\t50px,\tand\tpress Return.\tYou\tmay\tneed\tto\tscroll\tthe\tpage,\tbut\tyou\twill\tsee\tthat\tthe\tul\u2019s\tfont-size\thas overridden\tthe\tbody\u2019s\t(Figure\t3.14).","Figure\t3.14\t\tGiving\tthe\tul\ta\tfont-size\tof\t50px Not\tall\tstyle\tproperties\tare\tinherited\t\u2013\tborder,\tfor\texample,\tis\tnot.\tTo\tfind\tout\twhether\ta property\tis\tinherited,\trefer\tto\tthe\tproperty\u2019s\tMDN\treference\tpage. Back\tin\tstyles.css,\tupdate\tyour\tdeclaration\tblock\tfor\tthe\t.thumbnail-title\tclass\tto override\tthe\tbody\u2019s\tfont-size\tand\tuse\ta\tlarger\tfont. body\t{ \t\tfont-size:\t10px; } .thumbnail-title\t{ \t\tdisplay:\tblock; \t\tmargin:\t0; \t\tpadding:\t4px\t10px; \t\tbackground:\trgb(96,\t125,\t139); \t\tcolor:\trgb(202,\t238,\t255); \t\tfont-size:\t18px; } For\telements\tof\tthe\tclass\t.thumbnail-title,\tyou\tchanged\tthe\tfont\tsize\tto\t18\tpixels. Save\tstyles.css\tand\tadmire\tyour\tthumbnail\ttitles\tin\tChrome\t(Figure\t3.15). Figure\t3.15\t\tStyled\tthumbnail\ttitles They\tlook\tgood,\tbut\tthe\tuser\tagent\tstylesheet\tis\tadding\tunderlines\tto\tthe\t.thumbnail- title\telements.\tThis\tis\tbecause\tyou\twrapped\tthem\t(along\twith\tthe\t.thumbnail-image","elements)\twith\tan\tanchor\ttag,\tmaking\tthem\tinherit\tthe\tunderline\tstyle. You\tdo\tnot\tneed\tthe\tunderlines,\tso\tyou\tare\tgoing\tto\tremove\tthem\tby\tchanging\tthe\ttext- decoration\tproperty\tfor\tthe\tanchor\ttags\tin\ta\tnew\tstyling\trule\tin\tstyles.css.\tWhat selector\tshould\tyou\tuse\tfor\tthis\trule? If\tyou\tare\tconfident\tthat\tyou\twant\tto\tremove\tthe\tunderlines\tfrom\tthe\tthumbnail\ttitles\tas well\tas\tany\tother\tanchor\telements\tin\tOttergram,\tyou\tcan\tsimply\tuse\tan\telement\tselector: a\t{ \t\t\/*\tstyle\tdeclaration\t*\/ } (The\ttext\tbetween\tthe\t\/*\t*\/\tindicators\tis\ta\tCSS\tcomment.\tCode\tcomments\tare\tignored\tby the\tbrowser;\tthey\tallow\tthe\tdeveloper\tto\tmake\tnotes\tin\tthe\tcode\tfor\tfuture\treference.) If\tyou\tthink\tyou\tmight\tuse\tanchors\tfor\tanother\tpurpose\t(and\twill\twant\tto\tstyle\tthem differently),\tyou\tcan\tpair\tthe\telement\tselector\twith\tan\tattribute\tselector,\tlike\tthis: a[href]{ \t\t\/*\tstyle\tdeclaration\t*\/ } This\tselector\twould\tmatch\tany\tanchor\telement\twith\tan\thref\tattribute.\tOf\tcourse,\tanchor elements\tgenerally\tdo\thave\thref\tattributes,\tso\tthat\tmight\tnot\tbe\ttargeted\tenough\tto\tmatch only\tthe\tthumbnail\timages\tand\ttitles.\tTo\tmake\tan\tattribute\tselector\tmore\tprecise,\tyou\tcan also\tspecify\tthe\tvalue\tof\tthe\tattribute,\tlike\tthis: a[href=\\\"#\\\"]{ \t\t\/*\tstyle\tdeclaration\t*\/ } This\tselector\twould\tmatch\tonly\tthose\tanchor\telements\twhose\thref\tattribute\thas\ta\tvalue\tof #. By\tthe\tway,\tyou\tcan\talso\tuse\tattribute\tselectors,\twith\tor\twithout\tvalues,\ton\ttheir\town,\tsuch as: [href]{ \t\t\/*\tstyle\tdeclaration\t*\/ } As\tit\thappens,\tOttergram\tis\ta\tfairly\tsimple\tproject\tand\tyou\twill\tnot,\tin\tfact,\tbe\tusing anchor\ttags\tfor\tanything\tother\tthan\tthe\tthumbnails\tand\ttheir\ttitles.\tIt\tis\ttherefore\tsafe\tto use\tan\telement\tselector,\tand\tyou\tshould\tdo\tso\tbecause\tit\tis\tthe\tmost\tstraightforward solution\twith\tthe\tright\tamount\tof\tspecificity. Add\tthe\tnew\tstyle\tdeclaration\tto\tstyles.css: body\t{ \t\tfont-size:\t10px; } a\t{ \t\ttext-decoration:\tnone; } .thumbnail-title\t{ \t\t... } Save\tyour\tfile\tand\tcheck\tyour\tbrowser.\tThe\tunderlines\tare\tgone\tand\tyour\tthumbnail\ttitles are\tnicely\tstyled\t(Figure\t3.16).","Figure\t3.16\t\tAfter\tsetting\ttext-decoration\tto\tnone Note\tthat\tyou\tshould\tnot\tremove\tthe\tunderlines\tfrom\tlinks\tthat\tare\tin\tnormal\ttext\t\u2013\ttext that\tis\tnot\tan\tobvious\theading,\ttitle,\tor\tcaption.\tThe\tunderlining\tof\tlinked\ttext\tis\tan important\tvisual\tindicator\tthat\tusers\thave\tcome\tto\texpect.\tYou\tdid\tit\there\tbecause\tthe thumbnails\tdo\tnot\trequire\tthe\tsame\tvisual\tcues.\tUsers\twill\treasonably\texpect\tthem\tto\tbe clickable. In\tthe\trest\tof\tthe\tchapter,\tyou\twill\tuse\tclass\tselectors\tto\tstyle\tthe\tthumbnail\timages,\tthe unordered\tlist\tof\timages,\tthe\tlist\titems\t(which\tinclude\tthe\tthumbnail\timages\tand\ttheir titles),\tand,\tfinally,\tthe\theader.\tGo\tahead\tand\tadd\tclass\tnames\tto\tthe\th1,\tul,\tli,\tand\timg elements\tin\tindex.html\tso\tthey\tare\tready\tas\tyou\tneed\tthem. ... \t\t<\/head> \t\t<body> \t\t\t\t<header> \t\t\t\t\t\t<h1>ottergram<\/h1> \t\t\t\t\t\t<h1\tclass=\\\"logo-text\\\">ottergram<\/h1> \t\t\t\t<\/header> \t\t\t\t<ul> \t\t\t\t<ul\tclass=\\\"thumbnail-list\\\"> \t\t\t\t\t\t<li> \t\t\t\t\t\t<li\tclass=\\\"thumbnail-item\\\"> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter1.jpg\\\"\talt=\\\"Barry\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<img\tclass=\\\"thumbnail-image\\\"\tsrc=\\\"img\/otter1.jpg\\\"\talt=\\\"Barry\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Barry<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t<li\tclass=\\\"thumbnail-item\\\"> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter2.jpg\\\"\talt=\\\"Robin\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<img\tclass=\\\"thumbnail-image\\\"\tsrc=\\\"img\/otter2.jpg\\\"\talt=\\\"Robin\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Robin<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t<li\tclass=\\\"thumbnail-item\\\"> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter3.jpg\\\"\talt=\\\"Maurice\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<img\tclass=\\\"thumbnail-image\\\"\tsrc=\\\"img\/otter3.jpg\\\"\talt=\\\"Maurice\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Maurice<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t<li\tclass=\\\"thumbnail-item\\\"> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter4.jpg\\\"\talt=\\\"Lesley\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<img\tclass=\\\"thumbnail-image\\\"\tsrc=\\\"img\/otter4.jpg\\\"\talt=\\\"Lesley\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Lesley<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t\t\t<li> \t\t\t\t\t\t<li\tclass=\\\"thumbnail-item\\\"> \t\t\t\t\t\t\t\t<a\thref=\\\"#\\\"> \t\t\t\t\t\t\t\t\t\t<img\tsrc=\\\"img\/otter5.jpg\\\"\talt=\\\"Barbara\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<img\tclass=\\\"thumbnail-image\\\"\tsrc=\\\"img\/otter5.jpg\\\"\talt=\\\"Barbara\tthe\tOtter\\\"> \t\t\t\t\t\t\t\t\t\t<span\tclass=\\\"thumbnail-title\\\">Barbara<\/span> \t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t<\/li> \t\t\t\t<\/ul> ... By\tadding\tclass\tnames\tto\tthese\telements,\tyou\thave\tgiven\tyourself\ttargets\tfor\tthe\tstyles you\twill\tbe\tadding. We\tfavor\tclass\tselectors\tover\tother\tkinds\tof\tselectors,\tand\tyou\tshould,\ttoo.\tYou\tcan\twrite very\tdescriptive\tclass\tnames\tthat\tmake\tyour\tcode\teasy\tto\tdevelop\tand\tmaintain.\tAlso,\tyou can\tadd\tmultiple\tclass\tnames\tto\tan\telement,\tmaking\tthem\ta\tflexible\tand\tpowerful\ttool\tfor","styling. Be\tsure\tto\tsave\tindex.html\tbefore\tmoving\ton.","Making\tImages\tFit\tthe\tWindow Following\tthe\tatomic\tstyling\tpattern,\tthe\timages\tare\tnext\tin\tline\tfor\tstyling.\tThey\tare\tso large\tthat\tthey\tare\tcut\toff\tunless\tthe\tbrowser\twindow\tis\talso\tlarge.\tAdd\ta\tstyling\trule\tfor .thumbnail-image\tin\tstyles.css\tto\tmake\tthe\tthumbnails\tfit\tin\tthe\twindow: ... a\t{ \t\ttext-decoration:\tnone; } .thumbnail-image\t{ \t\twidth:\t100%; } .thumbnail-title\t{ \t\t... } You\tset\tthe\twidth\tto\t100%,\twhich\tconstrains\tit\tto\tthe\twidth\tof\tits\tcontainer.\tThis\tmeans that\tas\tyou\twiden\tthe\tbrowser\twindow,\tthe\timages\tget\tproportionally\tlarger.\tCheck\tit\tout: Save\tstyles.css,\tswitch\tto\tyour\tbrowser,\tand\tmake\tyour\tbrowser\twindow\tlarger\tand smaller.\tThe\timages\tgrow\tand\tshrink\talong\twith\tthe\tbrowser\twindow,\talways\tkeeping their\tproportions.\tFigure\t3.17\tshows\tOttergram\tin\tone\tnarrow\tand\tone\twider\tbrowser window. Figure\t3.17\t\tFitting\tan\timage\tby\twidth If\tyou\tlook\tclosely,\tthe\tspacing\taround\tthe\t.thumbnail-titles\tis\toff,\tso\tthat\tit\tappears that\tthe\ttitles\tgo\twith\tthe\timages\tbelow\tthem.\tFix\tthat\tin\tstyles.css\tby\tsetting\tthe .thumbnail-image\u2019s\tdisplay\tproperty\tto\tblock.","... .thumbnail-image\t{ \t\tdisplay:\tblock; \t\twidth:\t100%; } ... Now\tthe\tspace\tbetween\tthe\timage\tand\tits\ttitle\tis\tgone\t(Figure\t3.18). Figure\t3.18\t\tAfter\tsetting\t.thumbnail-image\tto\tdisplay:\tblock Why\tdoes\tthis\twork?\tImages\tare\tdisplay:\tinline\tby\tdefault.\tThey\tare\tsubject\tto\tsimilar rendering\trules\tas\ttext.\tWhen\ttext\tis\trendered,\tthe\tletters\tare\tdrawn\talong\ta\tcommon baseline.\tSome\tcharacters,\tsuch\tas\tp,\tq,\tand\ty,\thave\ta\tdescender\t-\tthe\ttail\tthat\tdrops below\tthis\tbaseline.\tTo\taccommodate\tthem,\tthere\tis\tsome\twhitespace\tincluded\tbelow\tthe baseline. Setting\tthe\tdisplay\tproperty\tto\tblock\tremoves\tthe\twhitespace\tbecause\tthere\tis\tno\tneed\tto accommodate\tany\ttext\t(or\tany\tother\tdisplay:\tinline\telements\tthat\tmight\tbe\trendered alongside\tthe\timage).","Color It\tis\ttime\tto\texplore\tcolor\ta\tlittle\tmore\tdeeply.\tAdd\tthe\tfollowing\tcolor\tstyles\tfor\tthe\tbody element\tand\tthe\t.thumbnail-item\tclass\tin\tstyles.css. body\t{ \t\tfont-size:\t10px; \t\tbackground:\trgb(149,\t194,\t215); } a\t{ \t\ttext-decoration:\tnone; } .thumbnail-item\t{ \t\tborder:\t1px\tsolid\trgb(100%,\t100%,\t100%); \t\tborder:\t1px\tsolid\trgba(100%,\t100%,\t100%,\t0.8); } ... You\thave\tdeclared\tvalues\tfor\tthe\t.thumbnail-item\u2019s\tborder\ttwice.\tWhy?\tNotice\tthat\tthe two\tdeclarations\tuse\tslightly\tdifferent\tcolor\tfunctions:\trgb\tand\trgba.\tThe\trgba\tcolor function\taccepts\ta\tfourth\targument,\twhich\tis\tthe\topacity.\tHowever,\tsome\tbrowsers\tdo\tnot support\trgba,\tso\tproviding\tboth\tdeclarations\tis\ta\ttechnique\tthat\tprovides\ta\tfallback\tvalue. All\tbrowsers\twill\tsee\tthe\tfirst\tdeclaration\t(rgb)\tand\tregister\tits\tvalue\tfor\tthe\tborder property.\tWhen\tbrowsers\tthat\tdo\tnot\tsupport\trgba\tsee\tthe\tsecond\tdeclaration,\tthey\twill\tnot understand\tit\tand\twill\tsimply\tignore\tit,\tusing\tthe\tvalue\tfrom\tthe\tfirst\tdeclaration.\tBrowsers that\tdo\tsupport\trgba\twill\tuse\tthe\tvalue\tin\tthe\tsecond\tdeclaration\tand\tdiscard\tthe\tvalue from\tthe\tfirst\tdeclaration. (Wondering\twhy\tthe\tbody\u2019s\tbackground\tcolor\tis\tdefined\twith\tintegers\tand\tthe .thumbnail-item\u2019s\tborder\tcolor\tis\tdefined\twith\tpercentages?\tWe\twill\tcome\tback\tto\tthat\tin just\ta\tmoment.) Save\tstyles.css\tand\tswitch\tto\tyour\tbrowser\t(Figure\t3.19). Figure\t3.19\t\tBackground\tcolor\tand\tborders","In\tthe\tDevTools,\tyou\tcan\tsee\tthat\tChrome\tsupports\trgba.\tIt\tdenotes\tthat\tthe\trgb\tcolor\tis\tnot used\tby\tstriking\tthrough\tthe\tstyle\t(Figure\t3.20) Figure\t3.20\t\trgba\tis\tused\twhen\tsupported\tby\tbrowser Now,\tstill\tin\tthe\tDevTools,\tselect\tthe\tbody.\tIn\tthe\tstyles\tpane,\tnotice\tthe\tdeclaration\tfor the\tbackground\tcolor\tthat\tyou\tjust\tadded.\tTo\tthe\tleft\tof\tthe\tRGB\tvalue\tis\ta\tsmall\tsquare showing\tyou\twhat\tthe\tcolor\twill\tlook\tlike. Click\tthat\tsquare,\tand\ta\tcolor\tpicker\topens\t(Figure\t3.21).\tThe\tcolor\tpicker\tlets\tyou\tchoose a\tcolor\tand\twill\tgive\tyou\tthe\tCSS\tcolor\tvalue\tin\ta\tvariety\tof\tdifferent\tformats. Figure\t3.21\t\tThe\tcolor\tpicker\tin\tthe\tstyles\tpane To\tsee\tthe\tbackground\tcolor\tin\tdifferent\tcolor\tformats,\tclick\tthe\tup\tand\tdown\tarrows\tto the\tright\tof\tthe\tRGBA\tvalues.\tYou\tcan\tcycle\tthrough\tHSLA,\tHEX,\tand\tRGBA\tformats. The\tHSLA\tformat\t(which\tstands\tfor\t\u201chue\tsaturation\tlightness\talpha\u201d)\tis\tused\tless frequently\tthan\tthe\tothers,\tpartly\tbecause\tsome\tof\tthe\tmost\tpopular\tdesign\ttools\tdo\tnot","provide\tHSLA\tvalues\tthat\tare\taccurate\tfor\tCSS.\tIf\tyou\tare\tcurious\tabout\tHSLA,\tvisit\tthe HSLA\tExplorer\tat\tcss-tricks.com\/\u200bexamples\/H\u200b SLaExplorer. Take\ta\tlook\tat\tthe\tHEX\tvalue\tfor\tthe\tbackground\tcolor:\t#95C2D7.\tHEX,\tor\thexadecimal,\tis the\toldest\tcolor\tspecification\tformat.\tEach\tdigit\trepresents\ta\tvalue\tfrom\t0\tto\t15.\t(If\tyou are\tnot\tfamiliar\twith\thexadecimal\tnumbers,\tthis\tis\tdone\tby\tincluding\tthe\tcharacters\tA through\tF\tas\tdigits.)\tEach\tpair\tof\tdigits,\tthen,\tcan\trepresent\ta\tvalue\tfrom\t0\tto\t255.\tFrom left\tto\tright,\tthe\tpairs\tof\tdigits\tcorrespond\tto\tthe\tintensity\tof\tred,\tgreen,\tand\tblue\tin\tthe color\tbeing\tspecified\t(Figure\t3.22). Figure\t3.22\t\tHEX\tvalues\tcorrespond\tto\tred,\tgreen,\tand\tblue\tvalues Many\tfind\tHEX\tcolors\tunintuitive.\tA\tmodern\talternative\tis\tto\tuse\tRGB\t(red,\tgreen,\tand blue)\tvalues.\tIn\tthis\tmodel,\teach\tcolor\tis\talso\tassigned\ta\tvalue\tfrom\t0\tto\t255,\tbut\tthe values\tare\trepresented\tin\tmore\tfamiliar\tdecimal\tnumbers\tand\tseparated\tby\tcolor.\tAs mentioned\tearlier,\tfor\tmore\tcapable\tbrowsers\ta\tfourth\tvalue\tcan\tspecify\tthe\topacity\tor transparency\tof\tthe\tspecified\tcolor,\tfrom\t0.0\t(fully\ttransparent)\tto\t1.0\t(fully\topaque).\tThe opacity\tis\tofficially\tknown\tas\tthe\talpha\tvalue\t\u2013\thence\tthe\tA\tin\tRGBA.\tThe\tRGBA\tvalue of\tthe\tbody\u2019s\tbackground\tcolor\tis\t(149,\t194,\t215,\t1). As\tan\talternative\tto\tdeclaring\tinteger\tvalues\tfor\tred,\tgreen,\tand\tblue,\tyou\tcan\talso\tuse percentages,\tas\tyou\tdid\tfor\tthe\t.thumbnail-item\tborders.\tThere\tis\tno\tfunctional difference\tbetween\tthe\ttwo\toptions.\tJust\tdo\tnot\tmix\tpercentages\tand\tintegers\tin\tthe\tsame declaration. By\tthe\tway,\tfor\thelp\tselecting\tpleasing\tcolor\tpalettes,\tAdobe\tprovides\ta\tfree\tonline\ttool\tat color.adobe.com.","Adjusting\tthe\tSpace\tBetween\tItems Ottergram\tnow\thas\tsome\tnice\tcolors\treminiscent\tof\totters\u2019\tocean\thome.\tBut\tadding\tthe colors\thas\trevealed\tsome\tunwanted\twhitespace\tinside\tthe\tborder\tof\tthe\t.thumbnail-item elements.\tAlso,\tthose\tpesky\tbullets\tare\tdrawing\tattention\taway\tfrom\tthe\tglory\tof\tthe otters. To\tget\trid\tof\tthe\tbullets,\tset\tthe\t.thumbnail-list\u2019s\tlist-style\tproperty\tto\tnone\tin styles.css: ... .thumbnail-item\t{ \t\tborder:\t1px\tsolid\trgb(100%,\t100%,\t100%); \t\tborder:\t1px\tsolid\trgba(100%,\t100%,\t100%,\t0.8); } .thumbnail-list\t{ \t\tlist-style:\tnone; } .thumbnail-image\t{ \t\t... To\tget\trid\tof\tthe\twhitespace,\tyou\twill\tuse\tthe\tsame\ttechnique\tyou\tused\twith\tthe .thumbnail-image.\tEach\t.thumbnail-item\thas\tthat\twhitespace\tby\tdefault\tto accommodate\titems\tin\ta\tlist,\tjust\tas\tthe\t.thumbnail-image\telements\thad\twhitespace\tto accommodate\tneighboring\ttext.\tAdd\ta\tdisplay:\tblock\tdeclaration\tfor\t.thumbnail-item to\tremove\tit. ... .thumbnail-item\t{ \t\tdisplay:\tblock; \t\tborder:\t1px\tsolid\trgb(100%,\t100%,\t100%); \t\tborder:\t1px\tsolid\trgba(100%,\t100%,\t100%,\t0.8); } ... With\tthose\tadditions,\tthe\tbullets\tand\tthe\texcess\tspace\tabove\tthe\timages\tdisappear, resulting\tin\tthe\tmore\tpolished\tlayout\tshown\tin\tFigure\t3.23.","Figure\t3.23\t\tImproved\tlayout Why\tuse\ta\tbullet\tlist\tif\tyou\tdo\tnot\twant\tbullets?\tIt\tis\tbest\tto\tchoose\tHTML\ttags\tbased\ton what\tthey\tare\tand\tnot\thow\tthe\tbrowser\twill\tstyle\tthem\tby\tdefault.\tIn\tthis\tcase,\tyou\twant an\tunordered\tlist\tof\timages,\tso\ta\tul\tis\tthe\tway\tto\tgo.\tThe\tul\tcontainer\tfor\tyour\timages will\tlet\tyou\tstyle\tthem\tas\ta\tscrolling\tlist\twhen\tyou\tadd\ta\tdetail\timage\tto\tyour\tproject\tin Chapter\t4.\tThe\tfact\tthat\tthe\tbrowser\trepresents\tuls\twith\tbullets\tby\tdefault\tis\tnot important,\tas\tthey\tare\teasily\tremoved. Next,\tyou\tare\tgoing\tto\tadjust\tthe\tspacing\tof\tthe\titems\tin\tthe\tlist.\tThe\tindividual .thumbnail-item\telements\tcurrently\thave\tno\tspace\tbetween\tthem.\tYou\tare\tgoing\tto\tadd margins\tbetween\tadjacent\tthumbnails. However,\tyou\tdo\tnot\twant\tto\tadd\ta\tmargin\tto\tall\tof\tthe\tlist\titems.\tWhy\tnot?\tBecause\tthe heading\talready\thas\ta\tmargin,\tso\tthe\tfirst\tlist\titem\tdoes\tnot\tneed\tone.\tThis\tmeans\tthat\tyou cannot\tuse\tthe\t.thumbnail-item\tclass\tselector,\tat\tleast\tnot\ton\tits\town.\tInstead,\tyou\twill use\tselector\tsyntax\tthat\ttargets\telements\tbased\ton\ttheir\trelationship\tto\tother\telements. Relationship\tselectors Look\tagain\tat\tthe\tdiagram\tof\tyour\tproject\tin\tFigure\t3.10.\tIt\tlooks\tmuch\tlike\ta\tfamily\ttree, doesn\u2019t\tit?\tThis\tsimilarity\tgives\tthe\tset\tof\trelationship\tselectors\ttheir\tnames:\tdescendent","selectors,\tchild\tselectors,\tsibling\tselectors,\tand\tadjacent\tsibling\tselectors. Relationship\tselector\tsyntax\tincludes\ttwo\tselectors\t(like\tclass\tor\telement\tselectors)\tjoined by\ta\tsymbol\tcalled\ta\tcombinator\tthat\tdetermines\tthe\ttargeted\trelationship\tbetween\tthem. To\tunderstand\thow\trelationship\tselectors\twork,\tit\tis\timportant\tto\tkeep\tin\tmind\tthat\tthe browser\treads\tselector\tsyntax\tfrom\tright\tto\tleft.\tLet\u2019s\tlook\tat\tsome\texamples. A\tdescendent\tselector\ttargets\tany\telement\tof\tone\tspecified\ttype\tthat\tis\tthe\tdescendent\tof another\tspecified\telement.\tFor\texample,\tto\tselect\tany\tspan\telement\tthat\tis\tthe\tdescendent of\tthe\tbody\telement,\tthe\tsyntax\twould\tbe: body\tspan\t{ \t\t\/*\tstyle\tdeclarations\t*\/ } This\tsyntax\tuses\tno\tcombinator.\tBecause\tit\tis\tread\tfrom\tright\tto\tleft,\tit\ttargets\tany\tspan descended\tfrom\ta\tbody,\twhich\tin\tthe\tcurrent\tcode\tmeans\tthe\tthumbnail\ttitles.\tIt\twould also\taffect\tany\tspans\tthat\tmight\tbe\tadded\twithin\tthe\theader\tor\telsewhere\twithin\tthe\tbody. Note\tthat\tyou\tcan\talso\tuse\ta\tclass\tselector\t(or\tattribute\tselector,\tor\tindeed\tany\ttype\tof selector)\twithin\ta\trelationship\tselector,\tso\tthe\tselector\tabove\tcould\talso\tbe\twritten\tas: body\t.thumbnail-title\t{ \t\t\/*\tstyle\tdeclarations\t*\/ } Child\tselectors\ttarget\telements\tof\ta\tspecified\ttype\tthat\tare\tthe\timmediate\tchildren\tof another\tspecified\telement.\tChild\tselector\tsyntax\tuses\tthe\tcombinator\t>.\tTo\tuse\tchild selector\tsyntax\tto\ttarget\tall\tthe\tspans\tcurrently\tin\tOttergram,\tthe\tsyntax\twould\tbe: li\t>\tspan\t{ \t\t\/*\tstyle\tdeclarations\t*\/ } Reading\tfrom\tright\tto\tleft,\tthis\tselector\ttargets\tany\tspan\tthat\tis\tthe\timmediate\tchild\tof\ta\tli element\t\u2013\tagain,\tthe\tthumbnail\ttitles. Sibling\tselector\tsyntax\tuses\tthe\tcombinator\t~.\tAs\tyou\tmight\texpect,\tthis\tsyntax\ttargets elements\twith\tthe\tsame\tparent.\tHowever,\tbecause\tof\tthe\tdirectional\tnature\tof\trelationship selectors,\tthe\tresults\tmight\tnot\tbe\texactly\tas\tyou\texpect.\tTake\tthis\texample: header\t~\tul\t{ \t\t\/*\tstyle\tdeclarations\t*\/ } This\tselector\ttargets\tany\tul\tthat\tis\tpreceded\tby\ta\theader\twith\tthe\tsame\tparent\telement. This\tselector\twould\teffectively\ttarget\tOttergram\u2019s\tul,\tbecause\tit\thas\ta\tsibling\theader\tthat precedes\tit\tin\tthe\tcode.\tHowever,\treversing\tthe\tsyntax\t(ul\t~\theader)\twould\tresult\tin\tno elements\tbeing\tselected,\tbecause\tthere\tis\tno\theader\tpreceded\tby\ta\tsibling\tul. The\tfinal\trelationship\tselector\ttype\tis\tthe\tadjacent\tsibling\tselector,\twhich\ttargets\telements that\tare\timmediately\tpreceded\tby\ta\tsibling\tof\tthe\tspecified\ttype.\tThe\tadjacent\tsibling combinator\tis\t+: li\t+\tli\t{ \t\t\/*\tstyle\tdeclarations\t*\/ } This\tsyntax\twould\tselect\tall\tli\telements\timmediately\tpreceded\tby\ta\tsibling\tli.\tThe\tresult is\tthat\tthe\tdeclared\tstyles\twould\tbe\tapplied\tto\tthe\tsecond\tthrough\tfifth\tli\t\u2013\tbut\tnot\tthe first,\tbecause\tit\tis\tnot\timmediately\tpreceded\tby\tanother\tli.\t(Note\tthat\tthe\tgeneral\tsibling selector\tand\tthe\tadjacent\tsibling\tselector\twould\twork\tthe\tsame\tway\tat\tthe\tmoment,\tdue\tto","Ottergram\u2019s\trelatively\tsimple\tstructure.) Back\tto\tthe\ttask\tat\thand:\tadding\ta\tmargin\tto\tthe\ttop\tof\teach\tlist\titem\texcept\tthe\tfirst.\tIf you\tused\ta\tdescendent\tor\tchild\tselector\tto\ttarget\tthe\t.thumbnail-item\tclass\tor\tthe\tspan\tor li\telements,\tthe\tmargin\twould\tbe\tapplied\tto\tall\tfive\tthumbnails.\tBecause\tyou\twant\tto style\tall\tbut\tthe\tfirst,\tuse\tthe\tadjacent\tsibling\tsyntax\tin\tstyles.css\tto\tadd\ta\ttop\tmargin to\tonly\tthose\tthumbnails\tthat\tare\timmediately\tpreceded\tby\tanother\tthumbnail. ... a\t{ \t\ttext-decoration:\tnone; } .thumbnail-item\t+\t.thumbnail-item\t{ \t\tmargin-top:\t10px; } .thumbnail-item\t{ \t\t... Save\tyour\tfile\tand\tcheck\tout\tthe\tresults\tin\tyour\tbrowser\t(Figure\t3.24). Figure\t3.24\t\tSpacing\tbetween\tadjacent\t.thumbnail-item\telements Note\tthat\tthe\tDevTools\tgive\tyou\tan\teasy\tway\tto\tfind\tout\tthe\tnesting\tpath\tof\tan\telement, which\tcan\thelp\twith\twriting\trelationship\tselectors.\tIf\tyou\tclick\tone\tof\tthe\tspan\telements inside\tone\tof\tthe\tli\telements,\tyou\tcan\tsee\tits\tpath\tat\tthe\tbottom\tof\tthe\telements\tpanel (Figure\t3.25).","Figure\t3.25\t\tNesting\tpath\tshown\tby\tthe\telements\tpanel For\tone\tfinal\ttweak\tto\tthe\tthumbnail\tlist\u2019s\tappearance,\treturn\tto\tstyles.css\tand override\tthe\tpadding\tthat\tthe\tul\tinherits\tfrom\tthe\tuser\tagent\tstylesheet\tso\tthat\tthe\timages are\tno\tlonger\tindented. ... .thumbnail-list\t{ \t\tlist-style:\tnone; \t\tpadding:\t0; } ... As\tusual,\tsave\tyour\tfile\tand\tswitch\tto\tyour\tbrowser\tto\tsee\tyour\tresults\t(Figure\t3.26). Figure\t3.26\t\tul\twith\tpadding\tremoved Ottergram\tis\tstarting\tto\tlook\tpolished.\tWith\tsome\tstyling\tfor\tthe\theader,\tyou\twill\thave\ta nice\tstatic\tweb\tpage.","Adding\ta\tFont Earlier,\tyou\tadded\tthe\t.logo-text\tclass\tto\tthe\th1\telement.\tUse\tthat\tclass\tas\tthe\tselector for\ta\tnew\tstyling\trule\tin\tstyles.css.\tInsert\tit\tafter\tthe\tstyles\tfor\tthe\tanchor\ttag.\t(In general,\tthe\torder\tof\tyour\tstyles\tonly\tmatters\twhen\tyou\thave\tmultiple\trule\tsets\tfor\tthe same\tselector.\tIn\tOttergram,\tthe\tstyles\tare\tarranged\tin\troughly\tthe\tsame\torder\tas\tthey appear\tin\tthe\tcode.\tThis\tis\ta\tmatter\tof\tpreference,\tand\tyou\tare\tfree\tto\torganize\tyour\tstyles as\tyou\tsee\tfit.) ... a\t{ \t\ttext-decoration:\tnone; } .logo-text\t{ \t\tbackground:\twhite; \t\ttext-align:\tcenter; \t\ttext-transform:\tuppercase; \t\tfont-size:\t37px; } .thumbnail-item\t+\t.thumbnail-item\t{ \t\t... First,\tyou\tgave\tthe\theader\ta\twhite\tbackground.\tThen\tyou\tcentered\tthe\ttext\tinside\tthe .logo-text\telement\tand\tused\tthe\ttext-transform\tproperty\tto\tformat\tit\tas\tuppercase. Finally,\tyou\tset\tthe\tfont\tsize.\tYour\tresults\twill\tlook\tlike\tFigure\t3.27.","Figure\t3.27\t\tStyling\tthe\theader Ottergram\tlooks\tgreat.\tGreat\u2026\tbut\ta\tlittle\tplain\tfor\ta\twebsite\twith\totters.\tTo\tadd\tsome pizzazz,\tyou\tcan\tuse\ta\tfont\tfor\tthe\theader\tother\tthan\tthe\tdefault\tprovided\tby\tthe\tuser\tagent stylesheet. We\tincluded\tsome\tfonts\tin\tthe\tresource\tfiles\tyou\talready\tdownloaded\tand\tadded\tto\tyour project\tdirectory.\tTo\tuse\tthem,\tyou\tneed\tto\tcopy\tthe\tfonts\tfolder\tinto\tyour\tproject.\tPlace it\tinside\tyour\tstylesheets\tfolder\t(Figure\t3.28).","Figure\t3.28\t\tfonts\tfolder\tinside\tstylesheets\tfolder Now\tyou\tonly\tneed\tto\tpoint\tsome\tstyles\tto\tthose\tfonts. The\tresource\tfiles\tinclude\tmany\tformats\tof\teach\tfont.\tAs\tusual,\tdifferent\tbrowser\tvendors support\tdifferent\tkinds\tof\tfonts.\tTo\tsupport\tthe\twidest\tarray\tof\tbrowsers,\tyou\tneed\tto include\tall\tof\tthem\tin\tyour\tproject.\tYes,\tall\tof\tthem. To\thelp\tyou\tout,\tthe\t@font-face\tsyntax\tlets\tyou\tgive\ta\tcustom\tname\tto\ta\tfamily\tof\tfonts that\tyou\tcan\tthen\tuse\tin\tthe\trest\tof\tyour\tstyles. An\t@font-face\tblock\tis\ta\tlittle\tdifferent\tfrom\tthe\tdeclaration\tblocks\tyou\thave\tbeen\tusing. Inside\tof\tthe\t@font-face\tblock\tare\tthree\tmain\tparts: First,\tthe\tfont-family\tproperty,\twhose\tvalue\tis\ta\tstring\tidentifying\tthe\tcustom font\tname\tyou\tcan\tuse\tthroughout\tyour\tCSS\tfile. Next,\tseveral\tsrc\tdeclarations\tspecifying\tdifferent\tfont\tfiles.\t(Take\tnote\t\u2013\tthe order\tis\timportant!) Last,\tdeclarations\tthat\tmodify\tthe\tfont\u2019s\tpresentation,\tsuch\tas\tthe\tfont-weight and\tthe\tfont-style. Add\tan\t@font-face\tdeclaration\tfor\tthe\tlakeshore\tfont\tfamily\tto\tthe\ttop\tof\tstyles.css and\ta\tstyle\tdeclaration\tto\tuse\tthe\tnew\tfont\tfor\tthe\t.logo-text\tclass. @font-face\t{ \t\t\t\tfont-family:\t'lakeshore'; \t\t\t\tsrc:\turl('fonts\/LAKESHOR-webfont.eot'); \t\t\t\tsrc:\turl('fonts\/LAKESHOR-webfont.eot?#iefix')\tformat('embedded-opentype'), \t\t\t\t\t\t\t\t\turl('fonts\/LAKESHOR-webfont.woff')\tformat('woff'), \t\t\t\t\t\t\t\t\turl('fonts\/LAKESHOR-webfont.ttf')\tformat('truetype'), \t\t\t\t\t\t\t\t\turl('fonts\/LAKESHOR-webfont.svg#lakeshore')\tformat('svg'); \t\t\t\tfont-weight:\tnormal; \t\t\t\tfont-style:\tnormal; } body\t{ \t\tfont-size:\t10px; \t\tbackground:\trgb(149,\t194,\t215); } a\t{ \t\ttext-decoration:\tnone;","} .logo-text\t{ \tbackground:\twhite; \ttext-align:\tcenter; \ttext-transform:\tuppercase; \tfont-family:\tlakeshore; \tfont-size:\t37px; } ... Admittedly,\tgetting\tthe\t@font-face\tdeclaration\tjust\tright\tcan\tbe\ttricky,\tbecause\tthe\torder of\tthe\tindividual\turl\tvalues\tis\timportant.\tIt\tis\ta\tgood\tidea\tto\tkeep\ta\tcopy\tof\tthe\tdeclaration for\treference.\tYou\tcan\talso\tlook\tinto\tAtom\u2019s\tsnippets\tdocumentation\tat\tflight- manual.atom.io\/u\u200b sing-atom\/\u200bsections\/s\u200b nippets\tto\tsee\thow\tto\tcreate\tyour own\tcode\t\u201csnippet,\u201d\tor\ttemplate. After\tdeclaring\tthe\tcustom\t@font-face,\tthe\trest\tof\tyour\tCSS\thas\taccess\tto\tthe\tnew lakeshore\tvalue\tfor\tthe\tfont-family\tproperty.\tIn\tthe\t.logo-text\tdeclaration,\tyou\tset font-family:\tlakeshore\tto\tapply\tthe\tnew\tfont. Save\tstyles.css,\tswitch\tto\tChrome,\tand\tsee\thow\tgood\tit\tfeels\tto\thave\ta\tweb\tpage\tas stylish\tas\tan\totter\t(Figure\t3.29).","Figure\t3.29\t\tApplying\ta\tcustom\tfont\tto\tthe\theader You\tdid\ta\tlot\tof\tstyling\twork\tin\tthis\tchapter,\tand\tOttergram\tlooks\tgreat!\tIn\tthe\tnext chapter\tyou\twill\tmake\tit\teven\tbetter\tby\tadding\tinteractive\tfunctionality."]


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook