0% found this document useful (0 votes)
9 views2 pages

HTML5 Document Structure Explained

Uploaded by

zuanhanif8
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

HTML5 Document Structure Explained

Uploaded by

zuanhanif8
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

The <!

DOCTYPE html> declaration defines that this document is an HTML5 document


The <!DOCTYPE> declaration represents the document type, and helps browsers to
display web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).

The <html> element is the root element of an HTML page

The <head> element contains meta information about the HTML page

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)
can be written with uppercase or lowercase like title or TITLE

The <body> element defines the document's body, and is a container for all the
visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists,
etc.

The <h1> element defines a large heading


HTML headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading.
are titles or subtitles that you want to display on a webpage.
It is important to use headings to show the document structure.
<h1> headings should be used for main headings, followed by <h2> headings, then
the less important <h3>, and so on.
can specify the size for any heading with the style attribute, using the CSS
font-size property

The <p> element defines a paragraph


A paragraph always starts on a new line, and browsers automatically add some
white space (a margin) before and after a paragraph.

HTML links are defined with the <a> tag


The link's destination is specified in the href attribute.
The href attribute specifies the URL of the page the link goes to.

HTML images are defined with the <img> tag.


The source file (src), The src attribute specifies the path to the image to be
displayed
alternative text (alt), specifies an alternate text for an image, if the image
for some reason cannot be displayed. This can be due to a slow connection, or an
error in the src attribute, or if the user uses a screen reader.
width and height are provided as attributes, which specify the width and height
of the image (in pixels)

HTML elements with no content are called empty elements.

The <br> tag defines a line break, and is an empty element without a closing tag
want a line break (a new line) without starting a new paragraph

The style attribute is used to add styles to an element, such as color, font, size,
and more.
Setting the style of an HTML element
The CSS background-color property defines the background color for an HTML
element.
The CSS color property defines the text color for an HTML element
The CSS font-family property defines the font to be used for an HTML element
The CSS font-size property defines the text size for an HTML element
The CSS text-align property defines the horizontal text alignment for an HTML
element

You should always include the lang attribute inside the <html> tag, to declare the
language of the Web page. This is meant to assist search engines and browsers.

The title attribute defines some extra information about an element.

The value of the title attribute will be displayed as a tooltip when you mouse over
the element

The HTML standard does not require quotes around attribute values.
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.

The <hr> tag defines a thematic break in an HTML page, and is most often displayed
as a horizontal rule.
is used to separate content (or define a change) in an HTML page

The HTML <pre> element defines preformatted text.


is displayed in a fixed-width font (usually Courier), and it preserves both
spaces and line breaks

You might also like