Professional Documents
Culture Documents
Web Primer Companion: Richard Key
Web Primer Companion: Richard Key
Richard Key
Your Instructor
richard@modulus.io @busyrich RichardKey
Websites 101
Oddlyenough,awebsitecanbethoughtofasabuildingthatlivesinsideyourwebbrowser.This isbecausetheysharealotofthesameengineeringconcepts.Theybothhavesupport structures,theybothrequireutilitiestofunction,andtheybothstrivetohaveapleasingaesthetic tothem.Wecanbreakdownawebsitejustlikewecanabuilding,anditwillhelpusunderstand thebasicsofhowawebsiteworks. Allwebsiteshave,whatwecallintheindustry,aclientsidecomponentandaserverside component.Thekeydifferencebetweenthesetwopiecesiswheretheyarelocatedinrelationto you.Theserversideisaremoteresource,livingout"intheweb",whiletheclientsidelivesonly inyourwebbrowser.Whiletheydocommunicatewitheachother,andthiscommunicationis essential,botharetechnicallyremovedfromeachother.Awelldesignedwebsitecaneven functionsomewhatwithoutthatcommunicationline.
The Server-Side
Tocontinuewithourbuildinganalogy,theserversidecloselyresemblestheutilitiesprovidedtoa building.Utilitiesprovideeverythingabuildingneedstofunction,andthesamecanbesaidfora websiteanditsserversidecomponent.These"utilities"provideawebsitewithallitneedsto operate,exceptintheplaceofwaterorpower,dataandmediaarepipedintothewebsite. Theserversideisalsotheremotepartofthewebsite,meaningitlives"inthecloud"oroutinthe internetifyouwill.Itcannotbedirectlyaccessedinmostcasesandismuchmorecomplexas
The Client-Side
Theclientsidecanberepresentedasthebuildingitself.Itiscompletelycontainedonyour computer,inyourwebbrowser.Justlikeabuilding,theclientsidehasinternalstructure,an aestheticappeal,andawelldefinedfunction.Allthreeworktogethertogivethefullexperienceof whatyouactuallyinteractwithwhenvisitingawebsitebuteachhasitsplaceandimportance. Structure Anyselfrespectingbuildinghasasupportingstructure.Afoundationofraw,moldedmaterials thatgivesitarigidframeandformsthebaseforthenextlayersclingto.Theclientsidebegins withthesameconcept.Thisstructurecontainsnotonlythebasicformthewebsitetakes,butwill alsoinclude"rawmaterials"suchastext,images,andothermedia.Thelanguageweuseto buildthisiscalledHTML,whichwewillcovermoreindepthlater. Aesthetics Whilethestructureisthefoundation,therewillalwaysbeaneedtomakethingslookalittle better.Thisincludesthelayoutorplacementofvariouselements,colorsofthoseelements,and eventhesizetheyare.Werefertothisasaesthetics,andjustlikeanuglybuildingonthecorner, thesepropertiescanbejustasimportantasthestructureitself.Theaestheticsofawebsiteare expressedinalanguagecalledCSS,andagain,wewillgooverthismoreabitlater. Function Abuildingisjustabuildingwithoutthepeoplewithinit,utilizingit,andgivingitfunction.Theyalso controltheflowofutilities,modifythebuildingitself,andmaybeevenupdatealittleaesthetics alongtheway.Awebsitegetsthesamesortoffunctionalityfromscriptsthatperformallofthese needs,alongwithprocessingandcommunication.Thelanguagethesescriptsarewrittenin, JavaScript,isabitmorecomplexsowewillnotbecoveringthisinfulltoday. Thesethreeaspectscombinetogiveyouwhatyouseeandexperiencewhenyouaccessa website,withtheserversideprovidingtheheavylifting.Theyarewhatwewillbefocusingonin ourproject,sincetheserversideisalittleoutofourscopetoday.
wewilllearnHTMLandCSS,alongwithanunderstandingforhowtheyworktogethertocreatea website.Itallbeginswithastructure.
Structure as Markup
Thefirstthingweneedtodoiscomeupwithastructure,ablueprintforourwebsite.Thisis doneusingHTMLorHypertextMarkupLanguage.HTMLisfromacategoryoflanguagescalled Markuplanguages.Markuplanguagesprovideadefinedsetofinstructionsforannotatingand structuringvariousobjectsandtext.Markuplanguagesdifferfromprogramminglanguages,like thoseusedinthescriptsofawebsite,becausetheyonlydefineastructureandnotlogicor function. Allmarkuplanguagesutilize"tags"whicharejustrepresentationsofobjectsweuseinrealworld documents.Mostmarkuptagsarealsocontainersthatencompasstext,media,or(more commonly)othertags.Eachmarkuplanguagediffersonlyinwhattagsareusedandwhat attributesyoucanaddtothosetags. HereisanexampleofaMarkuptag(notanactualtag):
<atagattribute="value"><btag></btag></atag>
Eachtagwillhaveanopeningtag,whichiswhereyouplaceattributes.Thisopeningtagalso denotesthatyouhave"opened"thecontainer,andeverythingafteritwillbeinsidethetag.Then, asyoucanguess,yousupplyaclosingtagtogatethecontentsofthetag.However,evenif nothingisputinsidethetag,inmostcasesyoumustsupplybothanopeningandclosingtag. HTML Example Funnythingis,markuplanguages(especiallyHTML)arebasedonrealworlddocuments.Just likeanessayyoumaywrite,ourwebsitewillneedatitle,sometext,afewimages,andeven somemetadatathatdescribesit.AllofthiswillbedefinedinoneHTML"document".Belowisan exampleofthemostbasicHTMLstructure,whichincludesafewcommonlyusedcontenttags. ThesetagsareactualHTMLtags,withdefinedtypesandfunctions.
Aesthetics as Styles
Structureisonething,butallwebsitesneedtobemorethantextthrownonthescreenwitha fewimagesinthemix.Youneedcolor,goodspacing,maybesomemarginshereandthere. Whilethestructurecanmakeawebsitedisorganized,badaestheticscanmakethesame websiteunusableandunattractive. ThestylesofawebsitearedescribedthroughalanguagecalledCascadingStyleSheets,or CSSforshort.Itworksbychangingthingslikesize,location,color,textformatting,etc.of variouselementsintheHTMLdocument.ThisprocessstartsbyselectingapieceoftheHTML document,thenapplyingthestylestotheselectedHTML.Let'sstartwithasimpleexampleof whatCSSlookslike:
Thepossibilitiesareendless,itisjustmatteroflearninghowtoselectwhatyouwantandwhat stylescanbeused.
Organization
ItistruethatallyourHTMLandCSScanbecontainedinonefile,butitisconsideredbad practice.Likeanystandardwayofdoingsomething,therearemanyreasonsnottocram everythingintoasinglefile.First,itisimpossibletoreusestylesacrossmultiplepageswithout copyingeverythingintotheotherfile,whichinturnmakesmanagementofthestylesimpossible. Italsolocksthestyleofthatpage.Ifyouwanttoupdatethewaythepagelooks,youwillhaveto
Resources
Presentation Presentation(PDF)
More Learning