rapid html prototyping with bootstrap 4

100
@ChrisGriffith Intro to HTML & CSS

Upload: uxpa-international

Post on 11-Apr-2017

359 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Rapid HTML Prototyping with Bootstrap 4

@ChrisGriffith

Intro to HTML & CSS

Page 2: Rapid HTML Prototyping with Bootstrap 4

What is HTML & CSS

HTML stands for HyperText Markup Language.

CSS stands for Cascading Style Sheets

HTML is the structure of our web page and CSS controls the visual presentation of our page

Page 3: Rapid HTML Prototyping with Bootstrap 4

Common HTML Terms:Elements

Elements are objects within a page. Common elements are paragraphs, anchors, div, span, headers.

<a><img>

Page 4: Rapid HTML Prototyping with Bootstrap 4

Common HTML Terms:Tags

Elements are often made of a set of tags. These can be referred to as opening tags and closing tags.

<a>…</a><img />

Page 5: Rapid HTML Prototyping with Bootstrap 4

Common HTML Terms:Attributes

Attributes are properties within an element. Common examples of this would be to assign an id, class or title to an element, or src path for an image, or a url for a hyperlink

<a href="http://ucsd.edu/">UCSD</a>

Page 6: Rapid HTML Prototyping with Bootstrap 4

HTML Document Structure & Syntax

All HTML documents have a required structure that includes the following declaration and tags: doctype, html, head, and body.

Page 7: Rapid HTML Prototyping with Bootstrap 4

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Page 8: Rapid HTML Prototyping with Bootstrap 4

<!DOCTYPE html>

Page 9: Rapid HTML Prototyping with Bootstrap 4

HTML Document Structure & Syntax

The head of the document is used to outline any meta data, the document title, and links to any external files.

Page 10: Rapid HTML Prototyping with Bootstrap 4

HTML Document Structure & Syntax

<!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8"> <title>Hello World</title> </head> <body> <h1>Hello World</h1> <p>This is a website.</p> </body></html>

Page 11: Rapid HTML Prototyping with Bootstrap 4

Common CSS Terms: Selectors

A selector determines exactly which element, or elements, the corresponding styles will be applied to. Selectors can include a combination of different IDs, classes, types, and other attributes – all depending on how specific you wish to be.

p { ... }

Page 12: Rapid HTML Prototyping with Bootstrap 4

Common CSS Terms: Properties

A property determines the style that will be applied to an element.

p { color: #ffff00; font-size: 16px;}

Page 13: Rapid HTML Prototyping with Bootstrap 4

Common CSS Terms: Values

A value determines the behavior of a property. Values can be identified as the text in-between the colon and semicolon.

p { color: #ffff00; font-size: 16px;}

Page 14: Rapid HTML Prototyping with Bootstrap 4

CSS Structure & Syntax

CSS works by using selectors to apply styles to HTML elements. All CSS styles cascade, allowing different styles to be inherited by multiple elements.

body { color: #ffff00;}p {

color: #00ff00;}

Page 15: Rapid HTML Prototyping with Bootstrap 4

Long vs. Short Hand

/* Long Hand */p { padding-top: 20px; padding-right: 30px; padding-bottom: 20px; padding-left: 30px;}/* Short Hand */p { padding: 20px 30px;}

Page 16: Rapid HTML Prototyping with Bootstrap 4

Comments within HTML & CSS

HTML comments wrap the content starting with <!-- and end with -->.

CSS comments wrap the content starting with /* and end with */.

CSS does allow for single line comments using the //.

Page 17: Rapid HTML Prototyping with Bootstrap 4

Selectors

CSS selectors are used to identify which HTML element to apply the style to.

Some of the most common selectors include elements, IDs, and classes, or some combination of the three.

Page 18: Rapid HTML Prototyping with Bootstrap 4

Type Selectors

Type selectors are the most basic selector.

<p> … </p>HTML

p { … }CSS

Page 19: Rapid HTML Prototyping with Bootstrap 4

Class Selectors

Classes are denoted in CSS by identifying the class with a leading period.

<div class="mobileCode">...</div>HTML

.mobileCode { ... }CSS

Page 20: Rapid HTML Prototyping with Bootstrap 4

ID Selectors

ID selectors are similar to class selectors however they are used to target only one unique element at a time.

<div id="masthead">...</div>HTML

#masthead { ... }CSS

Page 21: Rapid HTML Prototyping with Bootstrap 4

Combining Selectors

ul#social li { padding: 0 6px;}ul#social li a { height: 32px; width: 32px;}ul#social li.twitter a { background: url(’ollie.png') 0 0 no-repeat;}

Page 22: Rapid HTML Prototyping with Bootstrap 4

Selector Example

UNIVERSAL SELECTOR * { }

TYPE SELECTOR h1, h2, h3 { }

CLASS SELECTOR .note { }

ID SELECTOR #intro { }

CHILD SELECTOR li > a { }

DESCENDANT SELECTOR p a { }

ADJACENT SIBLING SELECTOR h1+p { }

GENERAL SIBLING SELECTOR h1~p {}

Page 23: Rapid HTML Prototyping with Bootstrap 4

Referencing CSS<!-- External CSS File --><link rel="stylesheet" href="mystyles.css">

<!-- Internal CSS --><style type="text/css">p { color: #ff6601; font-size: 16px;}</style>

<!-- Inline CSS --><p style="color: #ff6601; font-size: 16px;">A long time ago, in a galaxy...</p>

Page 24: Rapid HTML Prototyping with Bootstrap 4

Divisions & Spans

A div is a block level element commonly used to identify large sections of a web page, helping build the layout and design.

A span on the other hand, is an inline element commonly used to identify smaller sections of text.

<div>...</div>

<span>...</span>

Page 25: Rapid HTML Prototyping with Bootstrap 4

Block vs. Inline ElementsAll elements are either block or inline level elements. What’s the difference?

Block level elements begin on a new line on a page and occupy the full available width. Block level elements may be nested inside one another, as well as wrap inline level elements.

Inline level elements do not begin on a new line and fall into the normal flow of a document, maintaining their necessary width. Inline level elements cannot nest a block level element, however they can nest another inline level element.

Page 26: Rapid HTML Prototyping with Bootstrap 4

Typography

There are a number of different elements to display text on a web page within HTML.

HeadingsParagraphsBold Text with StrongItalicize Text with Emphasis

Page 27: Rapid HTML Prototyping with Bootstrap 4

Headings

Headings are block level elements that come in six different rankings, h1 through h6.

<h1>This is a Level 1 Heading</h1><h2>This is a Level 2 Heading</h2><h3>This is a Level 3 Heading</h3>

Page 28: Rapid HTML Prototyping with Bootstrap 4

Paragraphs

Paragraphs are defined by using the p block level element. <p>Here men from the planet Earth first set foot upon the Moon. July 1969 AD. We came in peace for all mankind.</p>

<p>What was most significant about the lunar voyage was not that man set foot on the Moon but that they set eyes on the earth.<p>

Page 29: Rapid HTML Prototyping with Bootstrap 4

Bold Text

To make text bold the strong inline level element is used.

<strong>...</strong>HTML5

<b>...</b>HTML4

Page 30: Rapid HTML Prototyping with Bootstrap 4

Italicize Text

To italicize text and place a stressed emphasis on it the em inline level element is used.

<em>...</em>HTML5

<i>...</i>HTML4

Page 31: Rapid HTML Prototyping with Bootstrap 4

Hyperlinks

One of the core elements of the internet is the hyperlink, established by using an anchor.

The href attribute, known as hyperlink reference, is used to set the destination of a link.

<a href="http://ucsd.edu">UCSD</a>

Page 32: Rapid HTML Prototyping with Bootstrap 4

Relative & Absolute Paths

The two most common types of links include links to other pages within a website and links to other websites. How these links are identified is by their path, also known as the value of their href attribute.

<!-- Relative Path --><a href="/about.html">About</a>

<!-- Absolute Path --><a href="http://www.google.com/">Google</a>

Page 33: Rapid HTML Prototyping with Bootstrap 4

Linking to an Email Address

To create an email link the href attribute value needs to start with mailto: followed by the email address to where the email should be sent.

<a href="mailto:[email protected]?subject=Hello&body=This%20is%20awesome">Email Me</a>

Page 34: Rapid HTML Prototyping with Bootstrap 4

Linking to Elements within the Same Page

Creating an on page link is accomplished by specifying an ID on the element you wish to link to. Then, using the ID of that element in a links href attribute value.

<a href="#awesome">Awesome</a><div id="awesome">Awesome Section</div>

Page 35: Rapid HTML Prototyping with Bootstrap 4

<br><br /><BR>

<img src="Logo.png" width=10 height=10 /><img src="Logo.png" width="10" height="10" />

All ok, but the stricter quoted style is preferred.

Page 36: Rapid HTML Prototyping with Bootstrap 4

<semantic markup/>

Page 37: Rapid HTML Prototyping with Bootstrap 4

HTML5 Structural Elements

<section /><header /><footer /><aside /><nav /><article /><hgroup />

Page 38: Rapid HTML Prototyping with Bootstrap 4

HTML4 structure

Page 39: Rapid HTML Prototyping with Bootstrap 4

Header

The header, just as it sounds, is used to identify the heading of a page, article, section, or other segment of a page.

<header>...</header>

Page 40: Rapid HTML Prototyping with Bootstrap 4

<header> != Masthead

Page 41: Rapid HTML Prototyping with Bootstrap 4

Navigation

The nav is a block level element used to denote a section of major navigational links on a page.

<nav><ul>

<li><a href="index.html">Home</a></li>

<li><a href="/about/">About</a></li>

<li><a href="/blog/">Blog</a></li></ul>

</nav>

Page 42: Rapid HTML Prototyping with Bootstrap 4

Section

As a block level element, section is defined to represent a generic document or application section.

<section>...</section>

Page 43: Rapid HTML Prototyping with Bootstrap 4

<div class="section"><h1>Taking Center Stage</h1><p>Drawing from over 30 years of touring the

world, Neil breaks down, demonstrates, and performs classic drum parts from songs spanning the entire Rush catalog, thereby giving the viewer the most in-depth insight into Neil’s body of work ever documented.</p>

<p>By Neil Peart</p></div>

Page 44: Rapid HTML Prototyping with Bootstrap 4

<section><h1>Taking Center Stage</h1><p>Drawing from over 30 years of touring the

world, Neil breaks down, demonstrates, and performs classic drum parts from songs spanning the entire Rush catalog, thereby giving the viewer the most in-depth insight into Neil’s body of work ever documented.</p>

<p>By Neil Peart</p></section>

Page 45: Rapid HTML Prototyping with Bootstrap 4

Footer

The footer is identical to that of the header however for the bottom of a page, article, section, or other segment of a page.

<footer>...</footer>

Page 46: Rapid HTML Prototyping with Bootstrap 4

<section><header>

<h1>Taking Center Stage</h1></header><p>Drawing from over 30 years of touring the

world, Neil breaks down, demonstrates, and performs classic drum parts from songs spanning the entire Rush catalog, thereby giving the viewer the most in-depth insight into Neil’s body of work ever documented.</p>

<footer><p>By Neil Peart</p>

</footer></section>

Page 47: Rapid HTML Prototyping with Bootstrap 4

Aside

To accompany the header and footer elements there is also the aside block level element.

<aside>...</aside>

Page 48: Rapid HTML Prototyping with Bootstrap 4
Page 49: Rapid HTML Prototyping with Bootstrap 4

HTML5 structure

Page 50: Rapid HTML Prototyping with Bootstrap 4

Text Color

The only item needed to set the color of text is the color property. The color property accepts one value, however in many different formats. You can use keywords, hexadecimal values, RGB, RGBa, HSL, and HSLa.

body { color: #867530;}

Page 51: Rapid HTML Prototyping with Bootstrap 4

Font Family

The font-family property is used to declare which font, and fallback fonts, should be used to display text. The value of the font-family property contains multiple font names, all comma separated.

p { font-family: 'Helvetica Neue', Arial, Helvetica, Roboto, sans-serif;}

Page 52: Rapid HTML Prototyping with Bootstrap 4

Font Size

Using the font-size property provides the ability to set the size of text using common length values, including pixels, em, percents, points, and rems.

p { font-size: 1.25em;}

Page 53: Rapid HTML Prototyping with Bootstrap 4

Font Style

To change text to italicized and vice versa the font-style property is utilized.

p { font-style: italic;}

Page 54: Rapid HTML Prototyping with Bootstrap 4

Font Weight

To set text as bold or set the specific weight of bold text appears, we can use the font-weight property.

p { font-weight: bold;}

Page 55: Rapid HTML Prototyping with Bootstrap 4

Line Height

Line height, the distance between two lines of text known as leading, is declared using the line-height property.

The best practice for legibility is to set the line-height to around one and half times that of your font-size.

p { line-height: 1.5em;}

Page 56: Rapid HTML Prototyping with Bootstrap 4

Shorthand Font Properties

All of the font based properties listed above may be combined and rolled into one font property and shorthand value. The order of these properties should fall as follows from left to right: font-style, font-variant, font-weight, font-size, line-height, and font-family.

h2, p { color: #555; font: 1em/1.75em Arial, 'Helvetica Neue', 'Lucida Grande', sans-serif;}

Page 57: Rapid HTML Prototyping with Bootstrap 4

Text Properties: Text Align

Using the text-align property such alignment can be set. The text-align property has five values, comprising of left, right, center, justify.

h1 { text-align: center;}

Page 58: Rapid HTML Prototyping with Bootstrap 4

Text Properties: Text Decoration

The text-decoration property accepting the following keyword values: none, underline, overline, line-through, blink, and inherit.

a { text-decoration: none;}

Page 59: Rapid HTML Prototyping with Bootstrap 4

Text Properties: Text Indent

The text-indent property can be used to indent text like seen within printed books. The text-indent property can be used to indent text both inward and outward, all depending on the set value.

p { text-indent: 20px;}

Page 60: Rapid HTML Prototyping with Bootstrap 4

Text Properties: Text Shadow

The text-shadow property allows you to add a shadow, or multiple shadows, to text.

h1 { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);}

Page 61: Rapid HTML Prototyping with Bootstrap 4

Text Properties: Text Transform

The text-transform property accepts five values: none, capitalize, uppercase, lowercase, and inherit.

h1 { text-transform: uppercase;}

Page 62: Rapid HTML Prototyping with Bootstrap 4

Embedding Web Fonts@font-face { font-family: 'Bryant Normal'; src: url('bryant-normal.eot'); src: url('bryant-normal.eot') format('embedded-opentype'), url('bryant-normal.woff') format('woff'), url('bryant-normal.ttf') format('truetype'), url('bryant-normal.svg') format('svg');}body { font-family: 'Bryant Normal', 'Helvetica Neue', Arial, Helvetica, sans-serif;}

Page 63: Rapid HTML Prototyping with Bootstrap 4

Backgrounds & GradientsAdding a background to an element can be accomplished in a few different ways, most often in the form of a solid color, an image, or a combination of the two. The ability to control exactly how a background is implemented on an element provides greater direction to the overall appearance.

With CSS3, new backgrounds and capabilities were introduced, including the ability to include gradient backgrounds and multiple background images on a single element. These progressions are becoming widely supported within all browsers and expand the possibilities of modern web design.

Page 64: Rapid HTML Prototyping with Bootstrap 4

Adding a Background Color

The quickest way to add a background to an element is to add a single color background using the background or background-color property.

div { background: #f60; background-color: #f60;}

Page 65: Rapid HTML Prototyping with Bootstrap 4

Adding a Background Image

On top of adding a background color to an element you can also add a background image.

div { background: url('texture.png'); background-image: url('texture.png');}

Page 66: Rapid HTML Prototyping with Bootstrap 4

Background Repeat

By default, a background image will repeat indefinitely, both vertically and horizontally, unless specified.

div { background: url('texture.png') no-repeat; background-image: url('texture.png'); background-repeat: no-repeat;}

Page 67: Rapid HTML Prototyping with Bootstrap 4

Background Position

Using the background-position property you can control exactly where the background image is placed or repeated from.

div { background: url('alert.png') 10px 10px no-repeat; background-image: url('alert.png'); background-position: 10px 10px; background-repeat: no-repeat;}

Page 68: Rapid HTML Prototyping with Bootstrap 4

Lists: Unordered & Ordered

Lists are an everyday part of life. To-do lists determine what to get done. Navigational routes provide a turn by turn list of directions. Recipes provide both a list of ingredients and a list of instructions.

HTML provides three different types of lists to choose from when building a page, including unordered, ordered, and definition lists.

Page 69: Rapid HTML Prototyping with Bootstrap 4

Unordered List

Unordered lists are purely a list of related items, in which their order does not matter nor do they have a numbered or alphabetical list element.

<ul> <li>iOS</li> <li>Android</li> <li>Windows Phone</li></ul>

Page 70: Rapid HTML Prototyping with Bootstrap 4

Ordered List

The ordered list element, ol, works just like the unordered list element. Instead of showing a dot as the default list item element, an ordered list uses numbers.

<ol> <li>iOS</li> <li>Android</li> <li>Windows Phone</li></ol>

Page 71: Rapid HTML Prototyping with Bootstrap 4

List Style Type Property• none

No list item• disc

A filled circle• circle

A hollow circle• square

A filled square• decimal

Decimal numbers• decimal-leading-zero

Decimal numbers padded by initial zeros

• lower-romanLowercase roman

numerals• upper-roman

Uppercase roman numerals• lower-greek

Lowercase classical Greek• lower-alpha / lower-latin

Lowercase ASCII letters• upper-alpha / upper-latin

Uppercase ASCII letters

Page 72: Rapid HTML Prototyping with Bootstrap 4

Using an Image as a List Item

There may come a time when the default list style type values are not enough, or you simply want to customize your own list item element.

li { background: url('tick.png') 0 0 no-repeat; list-style: none; padding-left: 20px;}

Page 73: Rapid HTML Prototyping with Bootstrap 4

Horizontally Displaying List

Occasionally lists may need to be displayed horizontally rather than vertically.

The quickest way to display a list within a single line is to set the list item to have a display property of inline.

li { display: inline; margin: 0 10px;}

Page 74: Rapid HTML Prototyping with Bootstrap 4

Navigational List Example

<ul> <li><a href="#" title="Profile">Profile</a></li> <li><a href="#" title="Settings">Settings</a></li> <li><a href="#" title="Notifications">Notifications</a></li> <li><a href="#" title="Logout">Logout</a></li></ul>

HTML

Page 75: Rapid HTML Prototyping with Bootstrap 4

Navigational List Example

ul { list-style: none; margin: 0;}li { float: left;}

CSS

Page 76: Rapid HTML Prototyping with Bootstrap 4

Navigational List Example

a { background: #404853; background: linear-gradient(#687587, #404853); border-left: 1px solid rgba(0, 0, 0, 0.2); border-right: 1px solid rgba(255, 255, 255, 0.1); color: #fff; display: block; font-size: 11px; font-weight: bold; padding: 0 20px; line-height: 38px; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.6); text-transform: uppercase;}

CSS

Page 77: Rapid HTML Prototyping with Bootstrap 4

Navigational List Example

li:first-child a { border-left: none; border-radius: 4px 0 0 4px;}li:last-child a { border-right: none; border-radius: 0 4px 4px 0;}

CSS

Page 78: Rapid HTML Prototyping with Bootstrap 4

Adding Images

For the img element to work, a src attribute value must be included to specify the source of the requested image. The src attribute value comes in way of a URL, most often relative to the server upon which the website is hosted.

<img src="cats.jpg" alt="grumpy cat">

Page 79: Rapid HTML Prototyping with Bootstrap 4

Sizing Images

There are a couple of different ways to size images so that they work well on a page. One option is to use the height and width attributes directly within the img tag in HTML.

img { height: 200px; width: 200px;}

<img src="cat.jpg" width="200" height="200" />

Page 80: Rapid HTML Prototyping with Bootstrap 4

Forms

Forms are an essential part of the internet as they provide a way for websites to capture information about users, process requests, and give controls for nearly every use of an application imagined.

Page 81: Rapid HTML Prototyping with Bootstrap 4

Initializing a Form

To begin a form on a page the form element must be used. The form element signifies where on the page control elements will appear.

<form action="#" method="foo"> ...</form>

Page 82: Rapid HTML Prototyping with Bootstrap 4

Text Fields

One of the primary elements used to obtain text from users is the input element.

Along with setting a type attribute it is also best practice to give an input a name attribute as well.

<input type="text" name="sample_text_field">

Page 83: Rapid HTML Prototyping with Bootstrap 4

HTML5 Inputs

Originally, the only two text based type attribute values were text and password, for password inputs.• color• date• datetime• datetime-local• email• month• number• range

• search• tel• time• url• week

Page 84: Rapid HTML Prototyping with Bootstrap 4

HTML5 Inputs

Page 85: Rapid HTML Prototyping with Bootstrap 4

Textarea

Another element used to capture text based data is the textarea element. The textarea element differs from the text input in that it is for larger passages of text spanning multiple columns.

<textarea name="sample_textarea">Sample textarea</textarea>

Page 86: Rapid HTML Prototyping with Bootstrap 4

Radio Buttons

Radio buttons are a quick and easy way to show a small list of options and allow users to make a quick decision. Radio buttons only allow users to select one option, as opposed to selecting multiple options.<input type="radio" name="day" value="Friday" checked> Friday<input type="radio" name="day" value="Saturday"> Saturday<input type="radio" name="day" value="Sunday"> Sunday

Page 87: Rapid HTML Prototyping with Bootstrap 4

Checkboxes

Checkboxes are very similar to that of radio buttons.

<input type="checkbox" name="day" value="Friday" checked> Friday<input type="checkbox" name="day" value="Saturday"> Saturday<input type="checkbox" name="day" value="Sunday"> Sunday

Page 88: Rapid HTML Prototyping with Bootstrap 4

Drop Down Lists

Drop down lists are a perfect way to provide users with a long list of options in a usable manner.

<select name="day"> <option value="Friday" selected>Friday</option> <option value="Saturday">Saturday</option> <option value="Sunday">Sunday</option></select>

Page 89: Rapid HTML Prototyping with Bootstrap 4

Submit Button

Users click the submit button to process data after filling out a form.

<input type="submit" name="submit" value="Submit Form">

Page 90: Rapid HTML Prototyping with Bootstrap 4

Label

Labels provide captions, or headings, for form elements. The value of the for attribute should be the same as the value of the id attribute included within the form element the label corresponds to.

<label for="username">Username</label><input type="text" name="username" id="username">

Page 91: Rapid HTML Prototyping with Bootstrap 4

Disabling

The disabled Boolean attribute turns off an element or control so that it is not available for interaction or input. Elements that are disabled will not send any values to the server for form processing.

<label for="username">Username</label><input type="text" name="username" id="username" disabled>

Page 92: Rapid HTML Prototyping with Bootstrap 4

Placeholder Attribute

The placeholder HTML5 attribute provides a tip within the control of an input and disappears once the control is clicked in, or gains focus.

<label for="username">Username placeholder</label><input type="text" name="username" id="username" placeholder="Holder">

Page 93: Rapid HTML Prototyping with Bootstrap 4

Required Attribute

The required HTML5 attribute enforces that an element or control contain a value upon being submitted to the server. Should an element or control not have a value an error message will be displayed requesting a user complete the required field. Currently error message styles are controlled by the browser and are unable to be styled with CSS.<label for="name">Name</label><input type="text" name="name" id="name" required>

Page 94: Rapid HTML Prototyping with Bootstrap 4

Creating a Table

In general tables are made up of data within rows and columns.

<table> ...</table>

Page 95: Rapid HTML Prototyping with Bootstrap 4

Table Row

A table can have numerous table rows, or tr elements.

<table> <tr> ... </tr> <tr> ... </tr></table>

Page 96: Rapid HTML Prototyping with Bootstrap 4

Table Data

The table data element creates a cell, of which may include data.<table> <tr> <td>Date</td> <td>Artist</td> <td>Location</td> <td>Time</td> </tr> <tr> <td>Monday, March 5th</td> <td>Rush: Clockwork Angels Tour</td> <td>United Center, Chicago, IL</td> <td>7:00 PM</td> </tr></table>

Page 97: Rapid HTML Prototyping with Bootstrap 4

HTML Coding Practices

HTML by nature is a forgiving language, allowing poor code to execute and render accurately.

<p id="intro"><strong>Lorem ipsum dolor sit.</p></strong><p id="intro">Ut enim veniam, quis nostrud exercitation.

Bad Code

<p class="intro"><strong>Lorem ipsum dolor sit.</strong></p><p class="intro">Ut enim veniam, quis nostrud exercitation.</p>

Good Code

Page 98: Rapid HTML Prototyping with Bootstrap 4

Make Use of Semantic Elements

HTML has well over 100 elements available for use. Deciding what elements to use to markup different content can be difficult…

<span class="heading"><strong>Welcome Back</span></strong><br /><br />Duis aute irure dolor in reprehenderit in voluptate.<br /><br />

Bad Code

<h1>Welcome Back</h1><p>Duis aute irure dolor in reprehenderit in voluptate.</p>

Good Code

Page 99: Rapid HTML Prototyping with Bootstrap 4

Use Practical ID & Class Values

Creating ID and class values can oddly be one of the more difficult parts of writing HTML.

<p class="red">Error! Please try again.</p>Bad Code

<p class="alert">Error! Please try again.</p>Good Code

Page 100: Rapid HTML Prototyping with Bootstrap 4

Resources

HTML and CSS: Design and Build Websites

Jon Duckett