an intro to html & css

35
AN INTRO TO HTML & CSS Shay Howe November 2011 www.shayhowe.com @shayhowe

Upload: shay-howe

Post on 21-Jan-2017

98 views

Category:

Design


0 download

TRANSCRIPT

Page 1: An Intro to HTML & CSS

AN INTRO TO

HTML & CSS

Shay HoweNovember 2011www.shayhowe.com – @shayhowe

Page 2: An Intro to HTML & CSS

An Intro to HTML & CSS

SHAY HOWEwww.shayhowe.com – @shayhowe

@shayhowe

Page 3: An Intro to HTML & CSS

An Intro to HTML & CSS

WHAT IS DESIGN?

@shayhowe

Page 4: An Intro to HTML & CSS

An Intro to HTML & CSS

WHAT IS DESIGN?“In most people’s vocabularies, design is a veneer. It’s

interior decorating. It’s the fabric of the curtains, of the

sofa. But to me, nothing could be further from the

meaning of design. Design is the fundamental soul of a

human-made creation that ends up expressing itself in

successive outer layers of the product.”

– Steve Jobs

@shayhowe

Page 5: An Intro to HTML & CSS

An Intro to HTML & CSS

WHAT IS HTML & CSS?

@shayhowe

Page 6: An Intro to HTML & CSS

An Intro to HTML & CSS

HTMLMarkup language to give

content structure and meaning.

@shayhowe

CSSPresentation language to

give content style and appearance.

Page 7: An Intro to HTML & CSS

An Intro to HTML & CSS

HTMLContent.

@shayhowe

CSSStyle.

Page 8: An Intro to HTML & CSS

An Intro to HTML & CSS

HTMLHyper Text Markup Language

@shayhowe

Page 9: An Intro to HTML & CSS

An Intro to HTML & CSS

ELEMENTS, ATTRIBUTES, & TAGSElementsbody,  h1,  p,  div,  strong,  em,  spanElements are HTML designators that define certain objects.

Attributeshref="http://shayhowe.com"  title="Shay  Howe"Attributes provide additional information to the given element.

Tags<div  id="shayhowe"  class="awesome"></div>Tags encompass elements and their corresponding attributes.

@shayhowe

Page 10: An Intro to HTML & CSS

BLOCK & INLINE ELEMENTSBlock

Block level elements begin on a new line within the document and occupy the full available width.

Inline

Inline level elements do not begin on a new line and fall into the flow of the document, maintaing their necessary width.

An Intro to HTML & CSS @shayhowe

headerfooterarticle

sectionasidediv

h1...h6ptable

formul,  ol,  lidl,  dt,  dd

spana

strongem

imgbr

inputabbr

Page 11: An Intro to HTML & CSS

An Intro to HTML & CSS

DOCUMENT STRUCTURE<!DOCTYPE  html><html>    <head>        <title>Hello  World</title>    </head>    <body>        <h1>Hello  World</h1>        <p>This  is  a  website.</p>    </body></html>

@shayhowe

Page 12: An Intro to HTML & CSS

An Intro to HTML & CSS

QUIZ

@shayhowe

Page 13: An Intro to HTML & CSS

An Intro to HTML & CSS

SAMPLE NAVIGATION HTML<ul  id="social">    <li  class="tumblr">        <a  href="http://blog.codeacademy.org">            Code  Academy  Tumblr  Blog        </a>    </li>    <li  class="mail">        <a  href="mailto:[email protected]">            Email  Code  Academy        </a>    </li>    <li  class="twitter">        <a  href="http://twitter.com/#!/codeacademy">            Code  Academy  Twitter        </a>    </li>    ...</ul>

@shayhowe

Page 14: An Intro to HTML & CSS

An Intro to HTML & CSS

SAMPLE NAVIGATION CSSul#social  {    list-­‐style:  none;  }

ul#social  li  {    float:  left;    margin:  12px  0  0  0;    padding:  0  3px;  }

ul#social  li  a  {    background:  url("icons.png")  0  0  no-­‐repeat;    display:  block;    height:  17px;    text-­‐indent:  -­‐9999px;    width:  16px;  }

ul#social  li.tumblr  a  {    background-­‐position:  0  -­‐64px;  }

ul#social  li.mail  a  {    background-­‐position:  0  -­‐81px;  }

ul#social  li.twitter  a  {    background-­‐position:  0  -­‐98px;  }

@shayhowe

Page 15: An Intro to HTML & CSS

An Intro to HTML & CSS

TAGS<ul  id="social">    <li  class="tumblr">        <a  href="http://blog.codeacademy.org">            Code  Academy  Tumblr  Blog        </a>    </li>    <li  class="mail">        <a  href="mailto:[email protected]">            Email  Code  Academy        </a>    </li>    <li  class="twitter">        <a  href="http://twitter.com/#!/codeacademy">            Code  Academy  Twitter        </a>    </li>    ...</ul>

@shayhowe

Page 16: An Intro to HTML & CSS

An Intro to HTML & CSS

ELEMENTS<ul  id="social">    <li  class="tumblr">        <a  href="http://blog.codeacademy.org">            Code  Academy  Tumblr  Blog        </a>    </li>    <li  class="mail">        <a  href="mailto:[email protected]">            Email  Code  Academy        </a>    </li>    <li  class="twitter">        <a  href="http://twitter.com/#!/codeacademy">            Code  Academy  Twitter        </a>    </li>    ...</ul>

@shayhowe

Page 17: An Intro to HTML & CSS

An Intro to HTML & CSS

ATTRIBUTES<ul  id="social">    <li  class="tumblr">        <a  href="http://blog.codeacademy.org">            Code  Academy  Tumblr  Blog        </a>    </li>    <li  class="mail">        <a  href="mailto:[email protected]">            Email  Code  Academy        </a>    </li>    <li  class="twitter">        <a  href="http://twitter.com/#!/codeacademy">            Code  Academy  Twitter        </a>    </li>    ...</ul>

@shayhowe

Page 18: An Intro to HTML & CSS

An Intro to HTML & CSS

ID & CLASS<ul  id="social">    <li  class="tumblr">        <a  href="http://blog.codeacademy.org">            Code  Academy  Tumblr  Blog        </a>    </li>    <li  class="mail">        <a  href="mailto:[email protected]">            Email  Code  Academy        </a>    </li>    <li  class="twitter">        <a  href="http://twitter.com/#!/codeacademy">            Code  Academy  Twitter        </a>    </li>    ...</ul>

@shayhowe

Page 19: An Intro to HTML & CSS

An Intro to HTML & CSS

REFERENCING A CSS FILE<!DOCTYPE  html><html>    <head>        <title>Hello  World</title>        <link  rel="stylesheet"  href="file.css">    </head>    <body>        <h1>Hello  World</h1>        <p>This  is  a  website.</p>    </body></html>

@shayhowe

Page 20: An Intro to HTML & CSS

An Intro to HTML & CSS

CSSCascading Style Sheets

@shayhowe

Page 21: An Intro to HTML & CSS

An Intro to HTML & CSS

SELECTOR, PROPERTY, VALUESelectorh1  {    font:  bold  16px/24px  Arial,  sans-­‐serif;  }A selector determines which element to apply style to.

Propertyh1  {    font:  bold  16px/24px  Arial,  sans-­‐serif;  }A property is the style that will be applied to the element.

Valueh1  {    font:  bold  16px/24px  Arial,  sans-­‐serif;  }A value is the determines the behavior of a property.

@shayhowe

Page 22: An Intro to HTML & CSS

An Intro to HTML & CSS

RULE SETS & DECLARATIONSRule Seth1  {    font:  bold  16px/24px  Arial,  sans-­‐serif;  }A rule set includes a selector and all corresponding declarations.

Declarationsh1  {    font:  bold  16px/24px  Arial,  sans-­‐serif;  }Declarations are individual lines of CSS within a rule set.

@shayhowe

Page 23: An Intro to HTML & CSS

An Intro to HTML & CSS

ELEMENT, ID, & CLASS SELECTORSElement Selectorh1  {    font:  bold  16px/24px  Arial,  sans-­‐serif;  }An element selector targets and element by its name.

ID Selector#logo  {    background:  url("logo.png")  0  0  no-­‐repeat;  }An ID selector targets and element by its ID. ID’s are to be reserved to one a page.

Class Selector.column  {    width:  200px;  }A class selector targets and element by its class. Classes may appear multiple times within a page.

@shayhowe

Page 24: An Intro to HTML & CSS

An Intro to HTML & CSS

QUIZ

@shayhowe

Page 25: An Intro to HTML & CSS

An Intro to HTML & CSS

QUIZul#social  {    list-­‐style:  none;  }

ul#social  li  {    float:  left;    margin:  12px  0  0  0;    padding:  0  3px;  }

ul#social  li  a  {    background:  url("icons.png")  0  0  no-­‐repeat;    display:  block;    height:  17px;    text-­‐indent:  -­‐9999px;    width:  16px;  }

ul#social  li.tumblr  a  {    background-­‐position:  0  -­‐64px;  }

ul#social  li.mail  a  {    background-­‐position:  0  -­‐81px;  }

ul#social  li.twitter  a  {    background-­‐position:  0  -­‐98px;  }

@shayhowe

Page 26: An Intro to HTML & CSS

An Intro to HTML & CSS

SELECTORSul#social  {    list-­‐style:  none;  }

ul#social  li  {    float:  left;    margin:  12px  0  0  0;    padding:  0  3px;  }

ul#social  li  a  {    background:  url("icons.png")  0  0  no-­‐repeat;    display:  block;    height:  17px;    text-­‐indent:  -­‐9999px;    width:  16px;  }

ul#social  li.tumblr  a  {    background-­‐position:  0  -­‐64px;  }

ul#social  li.mail  a  {    background-­‐position:  0  -­‐81px;  }

ul#social  li.twitter  a  {    background-­‐position:  0  -­‐98px;  }

@shayhowe

Page 27: An Intro to HTML & CSS

An Intro to HTML & CSS

PROPERTIESul#social  {    list-­‐style:  none;  }

ul#social  li  {    float:  left;    margin:  12px  0  0  0;    padding:  0  3px;  }

ul#social  li  a  {    background:  url("icons.png")  0  0  no-­‐repeat;    display:  block;    height:  17px;    text-­‐indent:  -­‐9999px;    width:  16px;  }

ul#social  li.tumblr  a  {    background-­‐position:  0  -­‐64px;  }

ul#social  li.mail  a  {    background-­‐position:  0  -­‐81px;  }

ul#social  li.twitter  a  {    background-­‐position:  0  -­‐98px;  }

@shayhowe

Page 28: An Intro to HTML & CSS

An Intro to HTML & CSS

VALUESul#social  {    list-­‐style:  none;  }

ul#social  li  {    float:  left;    margin:  12px  0  0  0;    padding:  0  3px;  }

ul#social  li  a  {    background:  url("icons.png")  0  0  no-­‐repeat;    display:  block;    height:  17px;    text-­‐indent:  -­‐9999px;    width:  16px;  }

ul#social  li.tumblr  a  {    background-­‐position:  0  -­‐64px;  }

ul#social  li.mail  a  {    background-­‐position:  0  -­‐81px;  }

ul#social  li.twitter  a  {    background-­‐position:  0  -­‐98px;  }

@shayhowe

Page 29: An Intro to HTML & CSS

An Intro to HTML & CSS

THE BOX MODEL

@shayhowe

Page 30: An Intro to HTML & CSS

An Intro to HTML & CSS

THE BOX MODELdiv  {    border:  4px  solid  #000;    height:  300px;    margin:  20px;    padding:  20px;    width:  300px;}

Breakdown

Total Width = Width + (Margin x 2) + (Border x 2) + (Padding x 2)388  Pixels  =  300  +  (20  x  2)  +  (4  x  2)  +  (20  x  2)

Total Height = Height + (Margin x 2) + (Border x 2) + (Padding x 2)388  Pixels  =  300  +  (20  x  2)  +  (4  x  2)  +  (20  x  2)

@shayhowe

Page 31: An Intro to HTML & CSS

An Intro to HTML & CSS

FLOATSimg  {    border:  1px  solid  #ccc;    float:  right    margin:  10px  0  10px  20px;    padding:  4px;}

<p>Ut  wisi  enin  ad  minim...</p>

<p><img  src="chicago.jpg"  alt="Chicago"  />Lorem  ipsum  dolor  sit  amet...</p>

<p>Mimimum  veniami  ex  ea  con...</p>

@shayhowe

Page 32: An Intro to HTML & CSS

An Intro to HTML & CSS

FLOATS

@shayhowe

Page 33: An Intro to HTML & CSS

An Intro to HTML & CSS

FLOATS & CLEARS.col  {    float:  left;    margin:  0  10px;    width:  400px;}.clear  {    clear:  both;}

<p  class="col">Lorem  ipsum  dolor  sit  amet...</p><p  class="col">Con  minimim  venami  quis...</p><div  class="clear"></div><p>Quis  nostrud  ad  nostris  pro  amat...</p>

@shayhowe

Page 34: An Intro to HTML & CSS

An Intro to HTML & CSS

FLOATS & CLEARS

@shayhowe

Page 35: An Intro to HTML & CSS

An Intro to HTML & CSS

QUESTIONS?Thank you!

@shayhowe