Hyper Text Markup Language, the standard markup language for creating Web pages
HTML
Describes the structure of a Web page
Consists of a series of elements
Elements tell the browser how to display the content
Elements label pieces of content
HTML element
Defined by a start tag, some content, and an end tag
Some HTML elements have no content (like the
element). These elements are called empty elements. Empty elements do not have an end tag!
HTML headings
Defined with the <h1> to <h6> tags, <h1> defines the most important heading, <h6> defines the least important heading
HTML paragraphs
Defined with the <p> tag
HTML images
Defined with the <img> tag, the source file (src), alternative text (alt), width, and height are provided as attributes
HTML links
Defined with the <a> tag, the destination is specified in the href attribute
Attributes are used to provide additional information about HTML elements
HTML elements can be nested (this means that elements can contain other elements)
HTML is not case sensitive, tags are not case sensitive
The HTML standard does not require quotes around attribute values, but W3C recommends quotes in HTML, and demands quotes for stricter document types like XHTML
Double quotes around attribute values are the most common in HTML, but single quotes can also be used
HTML attributes
href
src
width
height
alt
style
lang
title
The <!DOCTYPE> declaration represents the document type, and helps browsers to display web pages correctly
The <!DOCTYPE> declaration for HTML5 is: <!DOCTYPE html>
The <html> element is the root element and defines the whole HTML document
The <body> element defines the document's body, and is a container for all the visible contents
The <title> element specifies a title for the HTML page (which is shown in the browser's title bar or in the page's tab)
The
tag defines a line break, and is an empty element without a closing tag
HTML
Hypertext Markup Language - used to create web pages
Style Attribute
Used to set the style of an HTML element
Setting the style of an HTML element
1. Use the style attribute
2. The property is a CSS property
3. The value is a CSS value
Background Color
The CSS background-color property defines the background color for an HTML element
Setting background color
body style="background-color:powderblue;"
This is a heading
This is a paragraph
Text Color
The CSS color property defines the text color for an HTML element
Setting text color
h1 style="color:blue;">This is a heading</h1>
p style="color:red;">This is a paragraph</p
Fonts
The CSS font-family property defines the font to be used for an HTML element
Setting font family
h1 style="font-family:verdana;">This is a heading</h1>
p style="font-family:courier;">This is a paragraph</p
Text Size
The CSS font-size property defines the text size for an HTML element
Setting text size
h1 style="font-size:30px;">This is a heading</h1>
p style="font-size:36px;">This is a paragraph</p
Text Alignment
The CSS text-align property defines the horizontal text alignment for an HTML element