introduction to web design · element attributes • most elements can have attributes, which...

23
Introduction To Web Design By Tunde Omotayo

Upload: others

Post on 07-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

IntroductionToWebDesign

ByTundeOmotayo

Page 2: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

IntrotoWebDesignIntoday’slessonwearegoingtocover:• HTML• CSS• Createourfirstwebpage

Page 3: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

LayersOfWebDesign

STRUCTURE:HTMLSitePlanning

PRESENTATION:CSSStyle,Colors

Page 4: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

WhatisHTML?

• HyperTextMarkupLanguage,aformatforcreatingdocumentsandwebpages.• Describesthestructureofwebpagesusingmarkup.• AmarkuplanguageisasetofMarkuptags.• Purposeofthetagsistogroupanddescribepagecontent.• Inanutshell:“HTMLdescribesyourcontent”.

Page 5: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

PlainTextvsMarkUp

Page 6: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

HTMLStructure/Syntax

• HTMLtagsgivestructureandmeaningtoyourcontent.• Consistsofelements,textandtags.• <!DOCTYPEhtml>:notatagbutamessagetothebrowsertoinformwhatkindofhtmlisused.• <html>elementdefinestheHTMLdocument.• <head>elementcontainselementsthatdescribetabtitle,helpwithSEO.• <body>elementcontainswhatisshowninsidethebrowser.

<!DOCTYPE html><html><head><title>Page Title</title></head><body>

<h1>My First Heading</h1><p>My first paragraph.</p>

</body></html>

Page 7: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

Nesting/Format

• HTMLconsistsofmatchingpairsofangle-bracketstags.Theyenclosesections/textsthataredisplayedonthewebpage.• Nestingiswhentags“wrap”othertags.• Weindicatenestingby“indenting”thenestedtagsbypressingthe“tab”button.

<!DOCTYPE html><html>

<head><title></title>

</head><body>

<h1></h1><p></p>

</body></html>

Page 8: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

HTMLELEMENTS

Anatomy:

<tag>Content</tag>

• AnHTMLelementincludesboththeHTMLtagandeverythingbetweenthetag(thecontent).• Tagsusuallycomeinpairs,thefirstisthestarttagandthesecondistheendtag.• HTMLhasadefinedsetoftagnamesthatthebrowserunderstands.

Page 9: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

DefinedSetOfTagNames

Page 10: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

ElementAttributes

• Mostelementscanhaveattributes,whichprovidesadditionalInformationabouttheelement.

<divclass=“container”></div>

• Formatofattributes:name=“value”.Youcanusedoubleorsinglequotes.• Thisisveryusefulwhenwewanttogiveauniquestylethecontentsbetweenthetags.

Page 11: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

SpecialTags

• Comments• Singlelinecomments://This isacomment.• Multi-line comments:<!-- Thisisacomment.-->

• HTMLlinktags<a>:• <a href="https://www.w3schools.com">Thisisalink</a>

• Selfclosedtags:• Imagetag:<img src=“cat.jpg" alt=”nicecat”/>• <br/> insertsaline-break.• <hr/> insertsahorizontalrule(line)separator.

• Link:• <linkrel =“stylesheet”type=“css”href=“styles.css”>

Page 12: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

WhatisCSS?

• CascadingStyleSheet.• Stylesheetisasetofrulesdefininghowanhtmlelementwill”look”inthebrowser.• Mostelementswillinheritmanystylepropertiesfromtheelementsthatarenesting(wrapping)itbydefault.• Eg• ifwemakethebodyelementblue,alltheelementswithinthebodytagswillbebluebydefault.• Unlesswechoosetogiveauniquestyleorcolortoanelementwithinthebodytags.

Page 13: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

Example

• Ifwemakethebackgroundcolorofthebodyredandwestyleaparagraphwithinthebodytagstoapinkbackgroundcolor.Whatwillbethecoloroftheparagraphtag?

Page 14: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

CSSSyntax

• Syntax– rulesforhowalanguageiswritten.• CSSContains:Selectors&Declarations.• Selectoristheelementsinhtmlwewanttostyle.• Declarationscontainsatleastoneproperty/valuepair.

Page 15: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

ForExample

• body{background– color:blue}• p{font- family:Arial,Helvetica}• h1{font– size:24px}• a{color:red}

Page 16: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

ProperCSSformat+Multipledeclarations

body{color:blue;font– size:20px;}

• Selectoristypedinfrontofthedeclaration,withaspaceseparatingitandtheopeningcurly-bracket• Itisdonethiswaybecauseaselectorcanhavemultipledeclarations.• Also,forthesakeofreadability.

Page 17: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

MultipleSelectors• WecanalsohaveasituationwherewewanttoapplythesamestyletomultipleselectorsinCSS.Theselectorsareseparatedbyacomma.

Exampleh1,h2,h3,h4{

font-weight:bold;}

Page 18: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

TypesofSelectors

• Typeselectors:Selectorsthatfromthehtmlelementsname• Eg:

• body{declaration}• p{declaration}

• IDSelectors:htmlattributethatisaddedtoyourhtmlmarkup(tag).WereferencetheIDinCSSwithahash“#”.• Eg:

• InHTML:<img id=“logo”src=“”>• InCSS:#logo{declaration}

• ClassSelectors:htmlattributethatisaddedtoyourhtmlmarkup. WereferencetheclassinCSSwithaperiod“.”.• Eg:

• InHTML:<ul class=“sports”>• InCSS:.sports{declaration}

Page 19: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

IDvsClass

• AnIDismorespecific thanaclass.• AnelementcanhavebothanIDandmultipleclasses.• Ifwearestylingasectionwetypicallyuseclass.

Page 20: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

Wheredowebuildourwebpages?

• Wecancreatewebpagesusinganytexteditors.Samewaywecanplaybasketballinanyplaygroundwithhoops.• Butprofessionalbasketballplayersplayinabasketballcourtbecausethecourthasalltheequipmentthatisused.

• SomeofourprofessionalbasketballcourtsforWebpagecreationare:• OnlineEnvironment

• JSFiddle - https://jsfiddle.net/• DesktopApplication

• Brackets- http://brackets.io/

Page 21: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

Herewewillcreateourfirstwebpage

Page 22: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

Tostartoff

• Tostartoffletsgotoouttemplatehere:https://jsfiddle.net/4e3bdq6h/• Wewillworkfromhere.

Page 23: Introduction to Web Design · Element Attributes • Most elements can have attributes, which provides additional Information about the element. ... paragraph within the body tags

Thankyouforattending!