UI Design with HTML5 & CSS3

52
UI DESIGN WITH HTML5 & CSS3 Shay Howe @shayhowe www.shayhowe.com

Transcript of UI Design with HTML5 & CSS3

Page 2: UI Design with HTML5 & CSS3

UI Design with HTML5 & CSS3

SHAY HOWEwww.shayhowe.com – @shayhowe

@shayhowe

Page 3: UI Design with HTML5 & CSS3

HTML5 & CSS3HTMLAccessibility, Audio & Video Support, Figure Elements, Forms & Validation, New Elements & Attributes, Revised Elements & Attributes, Semantics, Structural Elements, Textual Elements, & more. CSSAnimations, Backgrounds, Borders, Flexible Grids, Responsive Design, Rounded Corners, Selectors, Shadows, Transforms, Transitions, Transparency, Typography, & more.

@shayhoweUI Design with HTML5 & CSS3

Page 4: UI Design with HTML5 & CSS3

HTML5 & CSS3HTMLAccessibility, Audio & Video Support, Figure Elements, Forms & Validation, New Elements & Attributes, Revised Elements & Attributes, Semantics, Structural Elements, Textual Elements, & more. CSSAnimations, Backgrounds, Borders, Flexible Grids, Responsive Design, Rounded Corners, Selectors, Shadows, Transforms, Transitions, Transparency, Typography, & more.

@shayhoweUI Design with HTML5 & CSS3

Page 5: UI Design with HTML5 & CSS3

TOOLTIP

@shayhoweUI Design with HTML5 & CSS3

Page 6: UI Design with HTML5 & CSS3

TOOLTIP MARKUP<p>    Beginning  of  a  general  paragraph  of  text...    <b  class="tooltip">        tooltip  to  rollover        <span>            Text  to  be  displayed  within  the  tooltip.        </span>    </b>    ...ending  of  the  paragraph.</p>

@shayhoweUI Design with HTML5 & CSS3

Page 7: UI Design with HTML5 & CSS3

SHOW/HIDE TOOLTIP.tooltip  {    border-­‐bottom:  1px  solid  #aaa;}.tooltip  span  {    background:  #000;    background:  rgba(0,  0,  0,  0.8);    display:  block;    padding:  10px  12px;    opacity:  0;    width:  100%}.tooltip:hover  span  {    opacity:  1;}

@shayhoweUI Design with HTML5 & CSS3

Page 8: UI Design with HTML5 & CSS3

TOOLTIP POSITION.tooltip  {    ...    position:  relative;}.tooltip  span  {    ...    bottom:  100%;    left:  -­‐12px;    position:  absolute;}

@shayhoweUI Design with HTML5 & CSS3

Page 9: UI Design with HTML5 & CSS3

TOOLTIP POSITION

@shayhoweUI Design with HTML5 & CSS3

Page 10: UI Design with HTML5 & CSS3

TOOLTIP ROUNDED CORNERS.tooltip  span  {    ...    -­‐webkit-­‐border-­‐radius:  4px;          -­‐moz-­‐border-­‐radius:  4px;            -­‐ms-­‐border-­‐radius:  4px;              -­‐o-­‐border-­‐radius:  4px;                    border-­‐radius:  4px;}

@shayhoweUI Design with HTML5 & CSS3

Page 11: UI Design with HTML5 & CSS3

TOOLTIP ROUNDED CORNERS

@shayhoweUI Design with HTML5 & CSS3

Page 12: UI Design with HTML5 & CSS3

TOOLTIP SHADOWS.tooltip  span  {    ...    -­‐webkit-­‐box-­‐shadow:  inset  0  1px  3px  #000;          -­‐moz-­‐box-­‐shadow:  inset  0  1px  3px  #000;            -­‐ms-­‐box-­‐shadow:  inset  0  1px  3px  #000;              -­‐o-­‐box-­‐shadow:  inset  0  1px  3px  #000;                    box-­‐shadow:  inset  0  1px  3px  #000;    text-­‐shadow:  0  1px  0  #000;}

@shayhoweUI Design with HTML5 & CSS3

Page 13: UI Design with HTML5 & CSS3

TOOLTIP SHADOWS

@shayhoweUI Design with HTML5 & CSS3

Page 14: UI Design with HTML5 & CSS3

TOOLTIP ARROW.tooltip  span:after  {    border-­‐left:  6px  solid  transparent;    border-­‐right:  6px  solid  transparent;    border-­‐top:  6px  solid  #000;    border-­‐top:  6px  solid  rgba(0,  0,  0,  0.8);    bottom:  -­‐6px;    content:  "";    height:  0;    left:  25%;    position:  absolute;    width:  0;}

@shayhoweUI Design with HTML5 & CSS3

Page 15: UI Design with HTML5 & CSS3

TOOLTIP ARROW

@shayhoweUI Design with HTML5 & CSS3

Page 16: UI Design with HTML5 & CSS3

RECAPHTMLAccessibilitySemantics CSSBackgroundsBox & Text ShadowsPositionPseudo SelectorsRounded CornersTransparency

@shayhoweUI Design with HTML5 & CSS3

Page 17: UI Design with HTML5 & CSS3

DOWNLOADS

@shayhoweUI Design with HTML5 & CSS3

Page 18: UI Design with HTML5 & CSS3

DOWNLOADS MARKUP<ul>    <li>        <a  href="files/pdf-­‐document.pdf">            PDF  Document        </a>    </li>    <li>        <a  href="files/word-­‐document.doc">            Word  Document        </a>    </li>    ...</ul>

@shayhoweUI Design with HTML5 & CSS3

Page 19: UI Design with HTML5 & CSS3

DOWNLOAD ATTRIBUTE<ul>    <li>        <a  href="files/pdf-­‐document.pdf"  download>            PDF  Document        </a>    </li>    <li>        <a  href="files/word-­‐document.doc"          download="super-­‐unique-­‐file-­‐name.doc">            Word  Document        </a>    </li>    ...</ul>

@shayhoweUI Design with HTML5 & CSS3

Page 20: UI Design with HTML5 & CSS3

GENERAL LIST STYLESul  {    border-­‐top:  1px  solid  #ddd;    list-­‐style:  none;}li  {    border-­‐bottom:  1px  solid  #ddd;    padding:  10px  0;}

@shayhoweUI Design with HTML5 & CSS3

Page 21: UI Design with HTML5 & CSS3

GENERAL LIST STYLES

@shayhoweUI Design with HTML5 & CSS3

Page 22: UI Design with HTML5 & CSS3

ADDING ICONSli  a  {    padding:  1px  0  1px  22px;}li  a[href$=".pdf"]  {    background:  url("pdf.png")  0  50%  no-­‐repeat;}li  a[href$=".doc"]  {    background:  url("doc.png")  0  50%  no-­‐repeat;}li  a[href$=".jpg"]  {    background:  url("image.png")  0  50%  no-­‐repeat;}...

@shayhoweUI Design with HTML5 & CSS3

Page 23: UI Design with HTML5 & CSS3

ADDING ICONS

@shayhoweUI Design with HTML5 & CSS3

Page 24: UI Design with HTML5 & CSS3

ADDING FILE PATHSli  a[href$=".pdf"]:after,li  a[href$=".doc"]:after,li  a[href$=".jpg"]:after,li  a[href$=".mp3"]:after,li  a[href$=".mp4"]:after  {    color:  #aaa;    content:  "  ("  attr(href)  ")";    font-­‐size:  11px;}

@shayhoweUI Design with HTML5 & CSS3

Page 25: UI Design with HTML5 & CSS3

ADDING FILE PATHS

@shayhoweUI Design with HTML5 & CSS3

Page 26: UI Design with HTML5 & CSS3

DOWNLOAD ATTRIBUTE SUPPORTli  a[href$=".pdf"][download]:not([download=""]):after,li  a[href$=".doc"][download]:not([download=""]):after,li  a[href$=".jpg"][download]:not([download=""]):after,li  a[href$=".mp3"][download]:not([download=""]):after,li  a[href$=".mp4"][download]:not([download=""]):after  {    content:  "  ("  attr(download)  ")";}

@shayhoweUI Design with HTML5 & CSS3

Page 27: UI Design with HTML5 & CSS3

ADDING FILE PATHS

@shayhoweUI Design with HTML5 & CSS3

Page 28: UI Design with HTML5 & CSS3

GETTING RESPONSIVE@media  only  screen  and  (min-­‐width:  320px)  {    a[href$=".pdf"]:after,    a[href$=".doc"]:after,    a[href$=".jpg"]:after,    a[href$=".mp3"]:after,    a[href$=".mp4"]:after  {        color:  #aaa;        content:  "  ("  attr(href)  ")";        font-­‐size:  11px;    }    ...}

@shayhoweUI Design with HTML5 & CSS3

Page 29: UI Design with HTML5 & CSS3

GOING MOBILE

@shayhoweUI Design with HTML5 & CSS3

Page 30: UI Design with HTML5 & CSS3

RECAPHTMLAccessibilityDownload AttributeSemantics CSSResponsive DesignAttribute, Negation, & Pseudo Selectors

@shayhoweUI Design with HTML5 & CSS3

Page 31: UI Design with HTML5 & CSS3

FORMS

@shayhoweUI Design with HTML5 & CSS3

Page 32: UI Design with HTML5 & CSS3

FORM MARKUP<form>    <label>        Departure  City        <input  type="text"  name="departure-­‐city">    </label>    <label>        Departure  Date  <span>(YYYY-­‐MM-­‐DD)</span>        <input  type="date"  name="departure-­‐date">    </label>    ...    <button>Search</button></form>

@shayhoweUI Design with HTML5 & CSS3

Page 33: UI Design with HTML5 & CSS3

FORM MARKUP

@shayhoweUI Design with HTML5 & CSS3

Page 34: UI Design with HTML5 & CSS3

FORM MARKUP

@shayhoweUI Design with HTML5 & CSS3

Page 35: UI Design with HTML5 & CSS3

INPUT PLACEHOLDERS<input  type="text"  name="departure-­‐city"    placeholder="City  or  Airport  Code">

<input  type="date"  name="departure-­‐date"    placeholder="YYYY-­‐MM-­‐DD">

@shayhoweUI Design with HTML5 & CSS3

Page 36: UI Design with HTML5 & CSS3

INPUT PLACEHOLDERS

@shayhoweUI Design with HTML5 & CSS3

Page 37: UI Design with HTML5 & CSS3

INPUT ASSISTANCE<input  type="text"  name="departure-­‐city"    placeholder="City  or  Airport  Code"      list="cities">

<datalist  id="cities">    <option  value="Boston  (BOS)">    <option  value="Chicago  (ORD)">    <option  value="New  York  (LGA)">    <option  value="San  Francisco  (SFO)">    <option  value="Seattle  (SEA)"></datalist>

@shayhoweUI Design with HTML5 & CSS3

Page 38: UI Design with HTML5 & CSS3

INPUT ASSISTANCE

@shayhoweUI Design with HTML5 & CSS3

Page 39: UI Design with HTML5 & CSS3

REQUIRED INPUTS<input  type="text"  name="departure-­‐city"    placeholder="City  or  Airport  Code"      list="cities"  required>

@shayhoweUI Design with HTML5 & CSS3

Page 40: UI Design with HTML5 & CSS3

REQUIRED INPUTS<input  type="date"  name="departure-­‐date"    placeholder="YYYY-­‐MM-­‐DD"  required>

@shayhoweUI Design with HTML5 & CSS3

Page 41: UI Design with HTML5 & CSS3

INPUT PATTERNS<input  type="date"  name="departure-­‐date"    placeholder="YYYY-­‐MM-­‐DD"  required    pattern="[0-­‐9]{4}-­‐(0[1-­‐9]|1[012])-­‐(0[1-­‐9]|    1[0-­‐9]|2[0-­‐9]|3[01])">

@shayhoweUI Design with HTML5 & CSS3

Page 42: UI Design with HTML5 & CSS3

MIN, MAX, & STEP<input  type="date"  name="departure-­‐date"    placeholder="YYYY-­‐MM-­‐DD"  required    pattern="[0-­‐9]{4}-­‐(0[1-­‐9]|1[012])-­‐(0[1-­‐9]|    1[0-­‐9]|2[0-­‐9]|3[01])"  min="2012-­‐07-­‐01"      max="2012-­‐08-­‐31"  step="2">

@shayhoweUI Design with HTML5 & CSS3

Page 43: UI Design with HTML5 & CSS3

VALIDATION

@shayhoweUI Design with HTML5 & CSS3

Page 44: UI Design with HTML5 & CSS3

VALIDATION STYLESinput:required:valid  {    background:  url("images/tick.png")  98%  50%          no-­‐repeat;}

@shayhoweUI Design with HTML5 & CSS3

Page 45: UI Design with HTML5 & CSS3

VALIDATION STYLES

@shayhoweUI Design with HTML5 & CSS3

Page 46: UI Design with HTML5 & CSS3

INPUT STATESinput:hover  {    border-­‐color:  #a3a3a3;}input:focus,  input:active  {    border:  1px  solid  #7aa3c3;    box-­‐shadow:        inset  0  1px  2px  rgba(0,  0,  0,  0.0),        0  0  0  2px  rgba(86,  145,  185,  0.2);    outline:  none;}

@shayhoweUI Design with HTML5 & CSS3

Page 47: UI Design with HTML5 & CSS3

INPUT STATES Default

Hover

Focus & Active

@shayhoweUI Design with HTML5 & CSS3

Page 48: UI Design with HTML5 & CSS3

INPUT TRANSITIONSinput  {    ...    -­‐webkit-­‐transition:        border  .2s  linear,  box-­‐shadow  .2s  linear;    -­‐moz-­‐transition:        border  .2s  linear,  box-­‐shadow  .2s  linear;    -­‐ms-­‐transition:        border  .2s  linear,  box-­‐shadow  .2s  linear;    -­‐o-­‐transition:        border  .2s  linear,  box-­‐shadow  .2s  linear;    transition:        border  .2s  linear,  box-­‐shadow  .2s  linear;}

@shayhoweUI Design with HTML5 & CSS3

Page 49: UI Design with HTML5 & CSS3

BUTTON GRADIENTbutton  {    ...    background:  #d5d5d5;    background:        -­‐webkit-­‐linear-­‐gradient(top,  #fff,  #ccc);    background:        -­‐moz-­‐linear-­‐gradient(top,  #fff,  #ccc);    background:        -­‐ms-­‐linear-­‐gradient(top,  #fff,  #ccc);    background:        -­‐o-­‐linear-­‐gradient(top,  #fff,  #ccc);    background:        linear-­‐gradient(top,  #fff,  #ccc);}

@shayhoweUI Design with HTML5 & CSS3

Page 50: UI Design with HTML5 & CSS3

BUTTON GRADIENT

@shayhoweUI Design with HTML5 & CSS3

Page 51: UI Design with HTML5 & CSS3

RECAPHTMLAccessibility & AssistanceInputs & ValidationInput AttributesSemantics CSSBackgroundsBordersAttribute & Pseudo SelectorsTransitions

@shayhoweUI Design with HTML5 & CSS3

Page 52: UI Design with HTML5 & CSS3

QUESTIONS?Thank you!

@shayhowe

http://shayhowe.com/ui

http://learn.shayhowe.com

@shayhoweUI Design with HTML5 & CSS3