html, css, bootstrap framework -...

142
HTML, CSS, Bootstrap Framework

Upload: phamdat

Post on 31-Mar-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

HTML, CSS, Bootstrap Framework

Page 2: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

What we will talk about:

Front-end vs Back-end coding at bswift

Defining HTML, CSS and Javascript

How the client stylesheets work

Examples

Tools

Page 3: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Static Pages / Dynamic Pages

Page 4: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

A static website is a group of self-contained, individual pages (or page), sent to the browser from

the server one-page-at-a-time.

SERVER

page.html page.html page.html

Page 5: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Dyamic web content is built when it is requested, by the user directly, or programmatically whilea user is on a page (e.g., facebook updates).

Most websites contain both static and dynamic elements.

SERVER page.html

SQL databases

.net

HTML

Page 6: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

SERVERREQUEST

HTMLCSS

Javascript

SQL databases

.net

Can I have a webpage, please?

back-end “recipe”

front-end

SERVERRESPONSE

thanks!

Page 7: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Server-side / Client-sideaka

Back End / Front-end

Page 8: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Client-side (front-end) coding includes HTML, CSS and Javascript. This just means that our code will be

downloaded from the server and then compiled entirely in the browser.

SERVERpage.html

.asp

SQL

etc

.net

BROWSER

style.css

script.js

Page 9: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

HTML, CSS, Javascript

Page 10: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Three layers of web design:

Structure, Style, Behavior

Page 11: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Three layers of web design

STRUCTURE

HTML markup

Site planning

PRESENTATION

CSS

Imagery

BEHAVIOR

Javascript

Page 12: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

HTML

Page 13: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Hyper Text+

Markup Language

Page 14: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Hyper Text

Page 15: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Markup Language

A markup language is a set of markup tags.

The purpose of the tags is to group and describe page content.

Page 16: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Markup Language

Without any markup to give your content structure, the browser renders unformatted and unstyled text, also known as “plain text”.

Page 17: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or
Page 18: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Markup Language

HTML tags give structure and meaning to your content. “Semantic markup” refers to the use of meaningful tags to describe content (e.g. using header tags for header content).

Page 19: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Markup Language

Once your content is marked up, the browser applies built-in default styles to the tags. While you can override these styles with css, your marked up, non-css styled document should be readable and have a clear hierarchy.

Page 20: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

doctype

html

head

body

Page 21: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

<!DOCTYPE html>

EXCEPTION

The doctype is not actually a tag, but a declaration, telling the browserwhat kind of html you are using. The

doctype above declares HTML 5.

Page 22: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

<html></html>STRUCTURE

The <html> element definesthe whole HTML document.

Page 23: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

<head></head>

The <head> element contains special elements that instruct the browser

where to find stylesheets, provide meta info, and more.

Page 24: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

<body></body>

The <body> element contains the document content (what is shown

inside the browser window).

Page 25: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Nesting

The use of our first three tags (html, head and body), introduces and important concept: Nesting, which is when tags “wrap” other tags. When you create markup, you should indicate nesting by indenting the nested tags with 2 spaces (preferred) or a tab.

<html>

<head> </head>

<body>

<h1></h1>

<p></p>

</body>

</html>

Page 26: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Document Hierarchy: Parents, children and siblings

Just as in a genealogy tree, the family hierarchy is described in terms of relationships. All elements in the document have a parent (up to ‘document’, which is at the top), and may have children (nested inside) or siblings (placed alongside).

<parent x>

<child and sibling y> </child and sibling y>

<child and sibling z> </child and sibling z>

</parent x>

Page 27: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

The ‘address’ of an element

The document hierarchy provides us with an ‘address’ for each element.

in the div with class “client-text-container”, make all of the h2 elements orange and 24px.

Page 28: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

HTML Elements

Page 29: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Anatomy of an Element

An HTML element includes boththe HTML tag and everything between

the tag (the content).

<tag>Content</tag>

Page 30: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Anatomy of an Element

Tags normally come in pairs. Thefirst tag is the start tag, and the second

tag is the end tag.

<tag>Content</tag>

Page 31: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Anatomy of an Element

HTML has a defined set of tag names (also called keywords) that

the browser understands.

<h1>Main Headline</h1>

Page 32: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

The essential element tags

PrimaryStructurehtmlheadbody

Head Elementstitlemetalink

StructuralElements(block)pbrh1 – h6

ul

ola

img

(div)

FormattingElements(inline)emistrongbqblockquote(span)

Page 33: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

eSpace

Nested Tags

Page 34: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

eSpace

Basic Structure

Page 35: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Head

eSpace

Page 36: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 37: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Body

eSpace

Page 38: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 39: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Headers

eSpace

Page 40: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 41: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Paragraph

eSpace

Page 42: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 43: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Lists

eSpace

Page 44: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 45: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Div

eSpace

Page 46: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 47: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Block elements

eSpace

Page 48: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Inline elements

eSpace

Page 49: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 50: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

More Inline elements

eSpace

Page 51: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 52: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Anatomy of an Element

Most elements can have attributes,which provides additional information

about the element.

<html lang=”en”></html>

Page 53: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Anatomy of an Element

Attributes always follow the sameformat: name=”value”. You can use

either single or double quotes.

<div class=”left-nav”></div>

Page 54: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

The essential attributes

link <link rel=”stylesheet” type-”text/css” href=”stylesheet/styles.css”>

img <img src=”images/image.jpg” alt=”Sam”>

a <a href=”http://colum.edu”>My school</a>

Page 55: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

CSS

Page 56: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Cascading+

Style Sheet

Page 57: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

A stylesheet is a set of rules defininghow an html element will be “presented” in the browser.

These rules are targeted to specific elements in the html document.

The Stylesheet

Page 58: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

The “cascade” part of CSS is a set of rules for resolving conflicts with multiple CSS rules applied to the same elements.

For example, if there are two rules defining the color or your h1 elements, the rule that comes last in the cascade order will “trump” the other.

The Cascade

Page 59: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Browser stylesheet

Linked (external) stylesheet

Embedded (internal) stylesheet

Inline (internal) Styles

low

imp

orta

nce

hig

h im

por

tanc

e

Page 60: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or
Page 61: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Most elements will inherit many style properties from their parent elements by default.

HTML

<body> <div> <ul> <li></li> </ul> </div></body>

relationship

parent of siteparent of ul and li, child of bodyparent of li, child of div and bodychild of ul, div, and body

Inheritance

Page 62: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

bodymake the paragraph 16px, Verdana, red

pmake the paragraph blue

16px, Verdana, blue

Inheritance

Page 63: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Shortly after styling your first html elements, you will find yourself wanting more control over where your styles are applied.

This is where specificity comes in.

Specificity refers to how specific your selector is in naming an element.

Specificity

Page 64: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

bodymake the paragraph 16px, Verdana, red

pmake the paragraph blue

16px, Verdana, pink

p.pinkmake the paragraph pink

Specificity

Page 65: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

HTML<div id=”plan-2323”> <p>Here is some text.</p> <p>Hide this text.</p><div>

<div id=”plan-2323”> <p>Here is some text.</p> <p class=”hideclass”>Hide this text.</p><div>

CSS

#plan-2323.hideclass {display: none}

Page 66: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or
Page 67: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

CSS Syntax

Syntax = the rules for how to write the language

Page 68: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Three terms for describing your styles:

CSS rule

CSS selector

CSS declaration

Page 69: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

selector {property: value;}

Every style is defined by a selector and a declaration. The declaration contains at least one property/value pair.Together they are called a CSS Rule.

declaration

CSS Rule

Page 70: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

body {font-family: Arial, Helvetica}p {color: #666666}h1 {font-size: 24px}a {color: blue}

The selector associates css rules with HTML elements.

CSS Selector

Page 71: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

p { color: red}

The selector is typed in front of the declaration, with a space separating it and the opening curly-bracket (aka curly-brace).

Typically, extra spaces and returns are added as shown for the sake of readability.

CSS Selector

Page 72: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

h1,h2,h3,h4 { font-weight: bold}

You can apply styles to multiple selectors in the same rule by separating the selectors with commas.

CSS Selector

Page 73: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

p { property: value}

The declaration is always defined in a property/value pair. The two are separated by a colon.

How you define the properties will affect how HTML elements are displayed.

CSS Declaration

Page 74: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

p { font-family: Arial, sans-serif; font-size: 14px; color: #666666;}

You can apply multiple declarations to a selector(s) by separating the delcarations with semi-colons.

CSS Declaration

Page 75: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

CSS Selectors

Page 76: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

p Type (element)

# ID

. Class

Page 77: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

body {declaration}p {declaration}h1 {declaration}ul {declaration}

The simplest selector is the type selector, which targets an html element by name.

Type (element) Selectors

Page 78: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Element Selector

eSpace

Page 79: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 80: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

The essential selector types (elements)

PrimaryStructurehtmlbody

BodyElementspbrh1 – h6ul

ol

aimg

div

FormattingElementsemistrongbqblockquotespan

Page 81: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

CSS

#logo {declaration}HTML

<img id=”logo” src=”” alt=””>

An ID is an html attribute that is added to your html markup. You reference that ID in your css with a hash.

ID Selectors

Page 82: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

ID Selector

eSpace

Page 83: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 84: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

CSS

.ingredients {declaration}HTML

<ul class=”ingredients”>

A class is an html attribute that is added to your html markup. You reference that ID in your css with a period.

Class Selectors

Page 85: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Class Selector

eSpace

Page 86: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 87: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

IDs vs Classes

The most important difference between IDs and classes is that there can be only one ID on a page, but multiple classes.

An ID is more specific than a class.

An element can have both an ID and multiple classes.

Page 88: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

IDs vs Classes

ID: #344-34-4344 Class: Male Class: Employee

ID: #123-54-9877 Class: Female Class: Employee

Page 89: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

2 Rules

eSpace

Page 90: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 91: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Descendant Selectors

CSS#sidebar .author {declaration}

HTML

<div id=”sidebar”> <p class=”author”></p></div>

A space between two selectors indicates a descendant selector. In the example above, the style is targeted to an element with the class “author” inside the id “sidebar”.

Page 92: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Descendent Selector

eSpace

Page 93: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 94: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Multiple classes

CSS.ingredients.time {declaration}

HTML

<div class=”ingredients time”> <h1></h1></div>

Elements can have multiple classes, giving you more control. The are written in the CSS in the exact order they appear in the html, with no spaces.

Page 95: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Box Model (Block)

eSpace

Page 96: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Box Model (Block)

eSpace

Page 97: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Box Model (Block)

eSpace

Page 98: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 99: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Margin collapse

eSpace

Page 100: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Margin collapse

eSpace

Page 101: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Box Model (Inline)

eSpace

Page 102: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Box Model (Inline)

eSpace

Page 103: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Preview

eSpace

Page 104: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Relative Position

eSpace

Page 105: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Absolute Position

eSpace

Page 106: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Fixed Position

eSpace

Page 107: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Float

eSpace

Page 108: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Float

eSpace

Page 109: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap is Front-end FrameworkHTML, CSS, and JS framework for

developing responsive, mobile first projects on the web.

www.getbootstrap.com

Page 110: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap is Ready-to-use Web ElementsHTML / CSS elements for button, form, table,image, navbar, label, progress bar, alert etc.

Page 111: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

EXAMPLESof Bootstrap Elements

Page 112: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

more EXAMPLESof Bootstrap Elements

Page 113: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Websites created by Bootstraphttp://unroll.me

Page 114: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Websites created by Bootstrapwww.fliplingo.com

Page 115: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Why Bootstrap?

● Save 100+ hours of coding● Easy to use web elements● Quick responsive prototype / website● Great documentation

Page 116: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Package

● CSS - bootstrap.css● JS - bootstrap.js● Icon Fonts - glyphicons-halflings-regular.ttf

Page 117: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap CDN

www.bootstrapcdn.com

Page 118: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Playgroundhttp://bit.ly/bs-play

Page 119: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Components

Start Workshop

Page 120: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

What is Grid in web design?

Page 121: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

What is Grid in web design?

12 Grid

1 2 3 4 5 6 7 8 9 10 11 12

Page 122: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

What is Grid in web design?

4 Grids x 3 Columns= 12 Grids

1 2 3 4 5 6 7 8 9 10 11 12

4 Grid 4 Grid 4 Grid

Page 123: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid

12 Responsive Grid

Page 124: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Grid Overlayfor Bootstrap & Foundation

http://bit.ly/grid-overlay

Page 125: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

4 Sizes of Bootstrap GridSize Name Screen Size CSS Class

Extra Small Devices (Phone)

0 - 767 px .col-xs-1 ~ .col-xs-12

Small Devices (Tablet) 768 - 991 px .col-sm-1 ~ .col-sm-12

Medium Devices (Desktop) 992 - 1219 px .col-md-1 ~ .col-md-12

Large Devices (Large screen desktop)

1200px + .col-lg-1 ~ .col-lg-12

Page 126: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

4 Sizes of Bootstrap GridSize Name Screen Size CSS Class

Extra Small Devices (Phone)

0 - 767 px .col-xs-1 ~ .col-xs-12

Small Devices (Tablet) 768 - 991 px .col-sm-1 ~ .col-sm-12

Medium Devices (Desktop) 992 - 1219 px .col-md-1 ~ .col-md-12

Large Devices (Large screen desktop)

1200px + .col-lg-1 ~ .col-lg-12

Page 127: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Example

How many grids in each box?

http://bit.ly/bs-agency

Page 128: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Example

4 grids x 3 Columns

Page 129: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Example

Page 130: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Example

Page 131: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Example 2

How many grids in each box?

Page 132: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Example 2

6 grids x 2 Columns

Page 133: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Example 2

Page 134: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Example 2

Page 135: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Row

1 Row = 12 Grids

Page 136: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Row

3 Rows

Page 137: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Row Example

Page 138: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Row Example

Page 139: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Responsive Grid

Columns will stack when responsive

Page 140: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Responsive Grid

1 2 3 1

2

3

Desktop Mobile

Columns stack on mobile

Page 141: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Workshop

3 Easy Steps:1. Add container2. Add row3. Add columns

Page 142: HTML, CSS, Bootstrap Framework - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/magistraleinformaticaec... · A static website is a group of self-contained, individual pages (or

Bootstrap Grid Workshophttp://bit.ly/bs-business