HTML

HTML tags

HTML tags

Thorbjörn Tasche

Thorbjörn Tasche

Fichier Détails

Cartes-fiches 24
Langue Deutsch
Catégorie Informatique
Niveau Autres
Crée / Actualisé 21.01.2015 / 22.04.2023
Lien de web
https://card2brain.ch/cards/html1
Intégrer
<iframe src="https://card2brain.ch/box/html1/embed" width="780" height="150" scrolling="no" frameborder="0"></iframe>

HTML Tags

<tagname>content</tagname>

The <!DOCTYPE> Declaration

<!doctype html>

The <!DOCTYPE> declaration helps the browser to display a web page correctly.

There are different document types on the web.

To display a document correctly, the browser must know both type and version.

HTML Documents

All HTML documents must start with a type declaration: <!DOCTYPE html>.

The HTML document itself begins with <html> and ends with </html>.

The visible part of the HTML document is between <body> and </body>.

HTML Headings

HTML headings are defined with the <h1> to <h6> tags:

HTML Paragraphs

HTML paragraphs are defined with the <p> tag:

HTML Links

<a href="http://www.w3schools.com">This is a link</a>

HTML Images

<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">

The lang Attribute

<html lang="en-US">

The title Attribute

<p title="About W3Schools">

 

In this example, the <p> element has a title attribute. The value of the attribute is "About W3Schools"

The alt Attribute

<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">

 

The alt attribute specifies an alternative text to be used, when an HTML element cannot be displayed.

HTML Horizontal Rules

The <hr> tag creates a horizontal line in an HTML page.

The HTML <head> Element

The HTML <head> element has nothing to do with HTML headings.

The HTML <head> element contains meta data. Meta data are not displayed.

The HTML <head> element is placed between the <html> tag and the <body> tag

 

<!DOCTYPE html>
<html>

<head>
  <title>My First HTML</title>
  <meta charset="UTF-8">
</head>

<body>
.
.
.

The HTML <title> Element

The HTML <title> element is meta data. It defines the HTML document's title.

The title will not be displayed in the document, but might be displayed in the browser tab.

More Meta Elements

In the chapter about HTML styles you discover more meta elements:

The HTML <style> element is used to define internal CSS style sheets.

The HTML <link> element is used to define external CSS style sheets.

HTML Line Breaks

The HTML <br> element defines a line break.

Use <br> if you want a line break (a new line) without starting a new paragraph

The HTML <pre> Element

The HTML <pre> element defines a block of pre-formatted text, with structured spaces and lines.

To display anything, with right spacing and line-breaks, you must wrap the text in a <pre> element:

The HTML Style Attribute

style="property:value"

 

The property is a CSS property. The value is a CSS value.

HTML Text Color

<h1 style="color:blue">

HTML Text Fonts

<h1 style="font-family:verdana">

HTML Text Size

<h1 style="font-size:300%">

HTML Text Alignment

<h1 style="text-align:center">

HTML Bold and Strong Formatting

The HTML <b> element defines bold text, without any extra importance.

 

<p><b>This text is bold</b>.</p>

The HTML <strong> element defines strong text, with added semantic "strong" importance.

<p><strong>This text is strong</strong>.</p>

HTML Italic and Emphasized Formatting

<p><i>This text is italic</i>.</p>