
























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This comprehensive html tutorial provides a foundational understanding of web development, covering essential concepts like html tags, elements, and attributes. It explores text formatting, styling, image integration, tables, lists, and javascript basics. The tutorial is designed for beginners and offers practical examples to enhance learning.
Typology: Study notes
1 / 96
This page cannot be seen from the preview
Don't miss anything!

























































































HTML is the standard markup language for creating Web pages. HTML stands for Hyper Text Markup Language HTML describes the structure of a Web page HTML consists of a series of elements HTML elements tell the browser how to display the content HTML elements are represented by tags HTML tags label pieces of content such as "heading", "paragraph", "table", and so on Browsers do not display the HTML tags, but use them to render the content of the page
Page Title
This is a Heading
This is a paragraph.
The declaration defines this document to be HTML The element is the root element of an HTML page The element contains meta information about the document The element specifies a title for the document The <body> element contains the visible page content The <h1> element defines a large heading The <p> element defines a paragraph
HTML tags are element names surrounded by angle brackets: <tagname>content goes here...</tagname> HTML tags normally come in pairs like <p> and </p> The first tag in a pair is the start tag, the second tag is the end tag The end tag is written like the start tag, but with a forward slash inserted before the tag name Tip: The start tag is also called the opening tag , and the end tag the closing tag.
The purpose of a web browser (Chrome, Edge, Firefox, Safari) is to read HTML documents and display them. The browser does not display the HTML tags, but uses them to determine how to display the document:
Web pages can be created and modified by using professional HTML editors.
All HTML documents must start with a document type declaration: . The HTML document itself begins with and ends with . The visible part of the HTML document is between and .
My First Heading
My first paragraph.
Coffee Tea Milk
An HTML element usually consists of a start tag and an end tag, with the content inserted in between:
The HTML element is everything from the start tag to the end tag:
My first paragraph.
Start tag Element content End tag My First Heading
My first paragraph.
The style attribute is used to specify the styling of an element, like color, font, size etc.
This is a paragraph.
Headings are defined with the to tags. defines the most important heading. defines the least important heading.
Heading 1 Heading 2 Heading 3 Heading 4 Heading 5 Heading 6
Search engines use the headings to index the structure and content of your web pages. Users often skim a page by its headings. It is important to use headings to show the document structure. headings should be used for main headings, followed by headings, then the less important , and so on.
Each HTML heading has a default size. However, you can specify the size for any heading with the style attribute, using the CSS font-size property:
Heading 1
The tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule. The element is used to separate content (or define a change) in an HTML page:
This is heading 1
This is some text.
This is heading 2
This is some other text.
The HTML
element defines a paragraph :
This is a paragraph.
This is another paragraph.
You cannot be sure how HTML will be displayed. Large or small screens, and resized windows will create different results.
The HTML element defines preformatted text. The text inside a element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks:
My Bonnie lies over the ocean. My Bonnie lies over the sea. My Bonnie lies over the ocean. Oh, bring back my Bonnie to me.
Setting the style of an HTML element, can be done with the style attribute. The HTML style attribute has the following syntax : < tagname style=" property : value; "> The property is a CSS property. The value is a CSS value. (You will learn more about CSS )
The CSS background-color property defines the background color for an HTML element. This example sets the background color for a page to powderblue:
This is a heading
This is a paragraph.
The CSS color property defines the text color for an HTML element:
This is a heading
This is a paragraph.
The CSS font-family property defines the font to be used for an HTML element:
This is a heading
This is a paragraph.
The CSS font-size property defines the text size for an HTML element:
This is a heading
This is a paragraph.
The CSS text-align property defines the horizontal text alignment for an HTML element:
Centered Heading
Centered paragraph.
Summary Use the style attribute for styling HTML elements Use background-color for background color Use color for text colors Use font-family for text fonts Use font-size for text sizes Use text-align for text alignmentThis text is bold This text is italic This is (^) subscript and superscript
In the previous chapter, you learned about the HTML style attribute.
HTML Small Formatting
The HTML element defines marked/highlighted text:
HTML Marked Formatting
The HTML element defines deleted/removed text.
My favorite color is blue red.
The HTML element defines inserted/added text.
My favorite color is red.
The HTML element defines subscripted text.
This is subscripted text.
The HTML element defines superscripted text.
This is superscripted text.
Tag Description
Defines bold text Defines emphasized text Defines italic text Defines smaller text Defines important text Defines subscripted text Defines superscripted text Defines inserted text Defines deleted text Defines marked/highlighted text
Here is a quote from WWF's website: For nearly 60 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by more than one million members in the United States and close to five million globally.
The HTML element defines a short quotation. Browsers usually insert quotation marks around the element.
The HTML element defines the title of a work. Browsers usually display elements in italic.
The Scream by Edvard Munch. Painted in 1893.
The HTML element defines bi-directional override. The element is used to override the current text direction:
This text will be written from right to left
Comment tags are used to insert comments in the HTML source code.
You can add comments to your HTML source by using the following syntax:
Notice that there is an exclamation point (!) in the opening tag, but not in the closing tag.
This is a paragraph.
Comments are also great for debugging HTML, because you can comment out HTML lines of code, one at a time, to search for errors:
HTML colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values.
In HTML, a color can be specified by using a color name:
You can set the background color for HTML elements:
Hello World
Lorem ipsum...
**Text Color** You can set the color of text:Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Hello World
Lorem ipsum...
Ut wisi enim...
To display black, set all color parameters to 0, like this: rgb(0, 0, 0). To display white, set all color parameters to 255, like this: rgb(255, 255, 255). Experiment by mixing the RGB values below: Shades of gray are often defined using equal values for all the 3 light sources:
HEX Value In HTML, a color can be specified using a hexadecimal value in the form:
Where rr (red), gg (green) and bb (blue) are hexadecimal values between 00 and ff (same as decimal 0-255). For example, #ff0000 is displayed as red, because red is set to its highest value (ff) and the others are set to the lowest value (00).
Styling HTML with CSS (CSS stands for C ascading S tyle S heets.) CSS describes how HTML elements are to be displayed on screen, paper, or in other media. CSS saves a lot of work. It can control the layout of multiple web pages all at once. CSS can be added to HTML elements in 3 ways: Inline - by using the style attribute in HTML elements Internal - by using a
This is a heading
This is a paragraph.
An external style sheet can be written in any text editor. The file must not contain any HTML code, and must be saved with a .css extension. Here is how the "styles.css" looks: body { background-color: powderblue; } h1 { color: blue; } p { color: red; }
The CSS color property defines the text color to be used. The CSS font-family property defines the font to be used. The CSS font-size property defines the text size to be used.
This is a heading
This is a paragraph.
CSS Border The CSS border property defines a border around an HTML element:
p { border: 1px solid powderblue; }
The CSS padding property defines a padding (space) between the text and the border:
p { border: 1px solid powderblue; padding: 30px; }
The CSS margin property defines a margin (space) outside the border:
p { border: 1px solid powderblue; margin: 50px; }
To define a specific style for one special element, add an id attribute to the element:
I am different
then define a style for the element with the specific id:#p01 { color: blue; }
To define a style for special types of elements, add a class attribute to the element: