Rapid HTML Prototyping with Bootstrap - Chris Griffith

66
RAPID PROTOTYPING RAPID PROTOTYPING WITH BOOTSTRAP WITH BOOTSTRAP

Transcript of Rapid HTML Prototyping with Bootstrap - Chris Griffith

Page 1: Rapid HTML Prototyping with Bootstrap - Chris Griffith

RAPID PROTOTYPINGRAPID PROTOTYPINGWITH BOOTSTRAPWITH BOOTSTRAP

Page 2: Rapid HTML Prototyping with Bootstrap - Chris Griffith
Page 3: Rapid HTML Prototyping with Bootstrap - Chris Griffith

WHO ARE YOU?WHO ARE YOU?

Page 4: Rapid HTML Prototyping with Bootstrap - Chris Griffith

SYSTEM SETUPSYSTEM SETUPGoogle Chrome ( )Brackets ( )

Course files

google.com/chrome/brackets.io

Page 5: Rapid HTML Prototyping with Bootstrap - Chris Griffith

AGENDAAGENDAPrototype ReviewIntroduction to BootstrapUnderstanding the Grid SystemUsing Bootstap ComponentsStyling Bootstrap

Page 6: Rapid HTML Prototyping with Bootstrap - Chris Griffith

OUR PROTOTYPEOUR PROTOTYPE

Page 8: Rapid HTML Prototyping with Bootstrap - Chris Griffith
Page 9: Rapid HTML Prototyping with Bootstrap - Chris Griffith
Page 10: Rapid HTML Prototyping with Bootstrap - Chris Griffith
Page 11: Rapid HTML Prototyping with Bootstrap - Chris Griffith
Page 12: Rapid HTML Prototyping with Bootstrap - Chris Griffith
Page 13: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LET’S GET STARTEDLET’S GET STARTED

Page 14: Rapid HTML Prototyping with Bootstrap - Chris Griffith

BOOTSTRAP BITS...BOOTSTRAP BITS... !! css/ "!! bootstrap.css "!! bootstrap.css.map "!! bootstrap.min.css "!! bootstrap-theme.css "!! bootstrap-theme.css.map #!! bootstrap-theme.min.css !! js/ "!! bootstrap.js #!! bootstrap.min.js !! fonts/ "!! glyphicons-halflings-regular.eot "!! glyphicons-halflings-regular.svg "!! glyphicons-halflings-regular.ttf "!! glyphicons-halflings-regular.woff #!! glyphicons-halflings-regular.woff2

Page 15: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 1LESSON 1BOOTSTRAP BASICSBOOTSTRAP BASICS

Page 16: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 2LESSON 2HEADERSHEADERS

Page 17: Rapid HTML Prototyping with Bootstrap - Chris Griffith

CONTAINERSCONTAINERS <div class="container"> ... </div

Use .container for a responsive fixed width container.

<div class="container-fluid"> ... </div

Use .container-fluid for a full width container, spanning the entire width of your viewport.

Page 18: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 3LESSON 3FRONT PAGE HEROSFRONT PAGE HEROS

Page 19: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 4LESSON 4UNDERSTANDING THE GRID SYSTEMUNDERSTANDING THE GRID SYSTEM

Page 20: Rapid HTML Prototyping with Bootstrap - Chris Griffith

UNDERSTANDING THE GRID SYSTEMUNDERSTANDING THE GRID SYSTEM

Page 21: Rapid HTML Prototyping with Bootstrap - Chris Griffith
Page 22: Rapid HTML Prototyping with Bootstrap - Chris Griffith

CUSTOM CSSCUSTOM CSS <style> div { background-color: #ccc; border: 1px solid #444; } .row { background-color: #fff; border: none; padding-top: 10px; } .container { margin-top: 5px; background-color: #fff; border: none; } </style>

Page 23: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 5LESSON 5APPLYING THE GRIDAPPLYING THE GRID

Page 24: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 6LESSON 6BUTTONSBUTTONS

or it's all about the click...

Page 25: Rapid HTML Prototyping with Bootstrap - Chris Griffith

BUTTONSBUTTONS

<a class="btn btn-default" href="#" role="button">Link</a> <button class="btn btn-default" type="submit">Button</button> <input class="btn btn-default" type="button" value="Input"> <input class="btn btn-default" type="submit" value="Submit">

Page 26: Rapid HTML Prototyping with Bootstrap - Chris Griffith

<button type="button" class="btn btn-default">Default</button>

<button type="button" class="btn btn-primary">Primary</button>

<button type="button" class="btn btn-success">Success</button>

<button type="button" class="btn btn-info">Info</button>

<button type="button" class="btn btn-warning">Warning</button>

<button type="button" class="btn btn-danger">Danger</button>

<button type="button" class="btn btn-link">Link</button>

Page 27: Rapid HTML Prototyping with Bootstrap - Chris Griffith

BUTTONSBUTTONSSIZESSIZES

Add .btn-lg, .btn-sm, or .btn-xs for additional sizes.

BLOCK LEVELBLOCK LEVEL

Create block level buttons—those that span the full width ofa parent— by adding .btn-block.

DISABLED STATEDISABLED STATE

Add the disabled attribute to <button> buttons.

Add the .disabled class to <a> buttons.

Page 28: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 7LESSON 7FOOTERSFOOTERS

or the lawyer part.

Page 29: Rapid HTML Prototyping with Bootstrap - Chris Griffith

FOOTERFOOTEROne of the new tags introductioned in HTML5, was the

footer tag <footer> <p>&copy; Some Company 2015</p> </footer>

Page 30: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 8LESSON 8BUILDING A CATALOG PAGEBUILDING A CATALOG PAGE

Page 31: Rapid HTML Prototyping with Bootstrap - Chris Griffith
Page 32: Rapid HTML Prototyping with Bootstrap - Chris Griffith

PLACEHOLDERPLACEHOLDERhttp://placehold.it/

Page 33: Rapid HTML Prototyping with Bootstrap - Chris Griffith

THUMBNAIL SNIPPETTHUMBNAIL SNIPPET <div class="row"> <div class="col-xs-6 col-md-3"> <a href="#" class="thumbnail"> <img src="imgs/192x200.gif" alt="..."> </a> </div> ...

Page 34: Rapid HTML Prototyping with Bootstrap - Chris Griffith

CATALOG PAGE V2CATALOG PAGE V2

Page 35: Rapid HTML Prototyping with Bootstrap - Chris Griffith

THUMBNAIL SNIPPETTHUMBNAIL SNIPPET <div class="row"> <div class="col-xs-6 col-md-3"> <div class="thumbnail"> <img src="imgs/192x200.gif" alt="..."> <div class="caption"> <h3>Product Name</h3> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> <p><a href="#" class="btn btn-primary" role="button">Add to Cart</a> </p> </div> </div> </div> ...

Page 36: Rapid HTML Prototyping with Bootstrap - Chris Griffith

GLYPHSGLYPHS

Page 37: Rapid HTML Prototyping with Bootstrap - Chris Griffith

GLYPHSGLYPHS<span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span>

Page 38: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 9LESSON 9BUILDING A DETAILS PAGEBUILDING A DETAILS PAGE

Tables and Tabs

Page 39: Rapid HTML Prototyping with Bootstrap - Chris Griffith
Page 40: Rapid HTML Prototyping with Bootstrap - Chris Griffith

TABLESTABLESBasic table: <table class="table">Striped rows: <table class="table table-striped">Bordered table: <table class="table table-bordered">Hover rows: <table class="table table-hover">

Page 41: Rapid HTML Prototyping with Bootstrap - Chris Griffith

TABSTABS <div role="tabpanel">

<!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li> ... </ul>

<!-- Tab panes --> <div class="tab-content"> ... </div> </div>

Page 42: Rapid HTML Prototyping with Bootstrap - Chris Griffith

LESSON 10LESSON 10BUILDING A CHECKOUT PAGEBUILDING A CHECKOUT PAGE

or what forms are for...

Page 43: Rapid HTML Prototyping with Bootstrap - Chris Griffith

FORMSFORMS

Page 44: Rapid HTML Prototyping with Bootstrap - Chris Griffith

FORM-GROUPSFORM-GROUPS <div class="form-group"> <label for="ccname">Name (as it appears on your card)</label> <input type="text" class="form-control" id="ccname"> </div>

<div class="form-group"> <label for="ccnumber">Card number (no dashes or spaces)</label> <input type="text" class="form-control" id="ccnumber"> </div>

Page 45: Rapid HTML Prototyping with Bootstrap - Chris Griffith

INLINE FORM ELEMENTSINLINE FORM ELEMENTSAdd .form-inline to your form (which doesn't have tobe a <form>) for le!-aligned and inline-block controls. This

only applies to forms within viewports that are at least768px wide.

Page 46: Rapid HTML Prototyping with Bootstrap - Chris Griffith

HORIZONTAL FORMSHORIZONTAL FORMSBootstrap's predefined grid classes can align labels andgroups of form controls in a horizontal layout by adding

.form-horizontal to the form.

Page 47: Rapid HTML Prototyping with Bootstrap - Chris Griffith

HORIZONTAL FORMSHORIZONTAL FORMS <form class="form-horizontal"> <div class="form-group"> <label for="ccname" class="col-sm-2 control-label">Name</label> <div class="col-sm-10"> <input type="text" class="form-control" id="ccname"> </div> </div> <div class="form-group"> <label for="ccnumber" class="col-sm-2 control-label">Card number</label> <div class="col-sm-10"> <input type="text" class="form-control" id="ccnumber"> </div> </div>

Page 48: Rapid HTML Prototyping with Bootstrap - Chris Griffith

SELECT MENUSSELECT MENUS <div class="form-group"> <select name="month" id="month" class="form-control"> <option value="01">01 - January</option> <option value="02">02 - February</option> ... </select> </div>

Page 49: Rapid HTML Prototyping with Bootstrap - Chris Griffith

SELECT MENUSSELECT MENUS <div class="form-group"> <select name="year" id="year" class="form-control"> <option value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> </select> </div>

Page 50: Rapid HTML Prototyping with Bootstrap - Chris Griffith

SIDE BY SIDESIDE BY SIDE <label for="expirationDate">Expiration date</label> <div class="row"> <div class="col-md-4"> <div class="form-group"> <select name="month" id="month" class="form-control"> ...

<div class="col-md-3"> <div class="form-group"> <select name="year" id="year" class="form-control">

Page 51: Rapid HTML Prototyping with Bootstrap - Chris Griffith

HEARD IT ON THE RADIO...HEARD IT ON THE RADIO... <div class="radio"> <label> <input type="radio" name="shippingOptions" id="freeShipping" value="0" checked> Free Shipping </label> </div> <div class="radio"> <label> <input type="radio" name="shippingOptions" id="twoDayShipping" value="2"> Two Day Shipping </label> </div> <div class="radio disabled"> <label> <input type="radio" name="shippingOptions" id="nextDayShipping" value="1" disabled> Next Day Shipping (sorry this option not available) </label> </div>

Page 52: Rapid HTML Prototyping with Bootstrap - Chris Griffith

CHECK 1, CHECK 2...CHECK 1, CHECK 2... <div class="checkbox"> <label> <input type="checkbox" id="saveInfo"> Save my information </label> </div>

Page 53: Rapid HTML Prototyping with Bootstrap - Chris Griffith

HELP!HELP!Help text should be explicitly associated with the form

control it relates to using the aria-describedby attribute. <input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock">

<span id="helpBlock" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>

Page 54: Rapid HTML Prototyping with Bootstrap - Chris Griffith

VALIDATION STATESVALIDATION STATESBootstrap includes validation styles for error, warning, and

success states on form controls. To use, add .has-warning, .has-error, or .has-success to the parent

element. <div class="form-group has-error"> <label class="control-label" for="inputErr1">Input with error </label> <input type="text" class="form-control" id="inputErr1"> </div>

Page 55: Rapid HTML Prototyping with Bootstrap - Chris Griffith

ICONSICONS

Page 56: Rapid HTML Prototyping with Bootstrap - Chris Griffith

ICONSICONSYou can also add optional feedback icons with the addition

of .has-feedback and the right icon. <div class="form-group has-success has-feedback"> <label class="control-label" for="success">Input with success</label> <input type="text" class="form-control" id="success" aria-describedby="successStatus"> <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> <span id="successStatus" class="sr-only">(success)</span> </div>

Page 57: Rapid HTML Prototyping with Bootstrap - Chris Griffith

ALERTSALERTSWrap any text and an optional dismiss button in .alert and

one of the four contextual classes:

successinfowarningdanger

Page 58: Rapid HTML Prototyping with Bootstrap - Chris Griffith

ALERTSALERTS <div class="alert alert-warning alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <strong>Oh snap!!</strong> Change a few things up and try submitting again. </div>

Page 59: Rapid HTML Prototyping with Bootstrap - Chris Griffith

BOOTSTRAP+BOOTSTRAP+

Page 60: Rapid HTML Prototyping with Bootstrap - Chris Griffith

OTHER COMPONENTSOTHER COMPONENTSAffixBadgesBreadcrumbsButton groupsCarouselsCollapseDropdownInput groupsJumbotronLabelsList group

Media objectModalsNavbarsNavsPaginationPanelsPopoversProgress barsResponsive embedScrollspyTooltipsTransitions

Page 61: Rapid HTML Prototyping with Bootstrap - Chris Griffith

STYLINGSTYLING

Page 62: Rapid HTML Prototyping with Bootstrap - Chris Griffith

STYLINGSTYLING .navbar { margin-bottom: 0; border-radius: 0; }

footer { margin-top: 20px; padding-top: 20px; padding-left: 5%; border-top: 1px solid #ccc; }

Page 64: Rapid HTML Prototyping with Bootstrap - Chris Griffith

GUI TOOLGUI TOOL

jetstrap.com

Page 65: Rapid HTML Prototyping with Bootstrap - Chris Griffith

RESOURCESRESOURCESbootsnipp.com/resourcesstackoverflow.com/expo.getbootstrap.com/resources/startbootstrap.com/bootstrap-resources/

Page 66: Rapid HTML Prototyping with Bootstrap - Chris Griffith

THANK YOU!THANK YOU!Chris Griffith

@chrisgriffith

http://chrisgriffith.wordpress.com