Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

BASIC HTML

. What is HTML:- HTML stands for HyperText Markup Language. It is a markup language
used to create web pages and web applications.
. Basic HTML structure:-HTML documents are made up of elements, which are enclosed in
tags. The basic structure of an HTML document includes:
. <!DOCTYPE html>
. <html>
. <head>
. <title>Page Title</title>
. </head>
. <body>
. <h1>Heading 1</h1>
. <p>Paragraph</p>
3
. </body>
● </html>
● The <!DOCTYPE html> declaration tells the browser that this is an HTML5 document.
● The <html> element is the root element of an HTML page.
● The <head> element contains information about the document, such as the title, meta
data, and links to external stylesheets and scripts.
● The <title> element specifies the title of the document, which is displayed in the browser's
title bar.
● The <body> element contains the content of the document, such as headings,
paragraphs, images, and links.
● The <h1> element defines a heading, and the <p> element defines a paragraph.
1
1
. HTML elements and tags:- HTML elements are the building blocks of web pages. They are
1
0
enclosed in tags, which define the purpose and content of the element. Some common
9
HTML elements include:
8
● <h1>, <h2>, <h3>, <h4>, <h5>, <h6>: Headings
7
● <p>: Paragraph
6
● <a>: Anchor (link)
5
● <img>: Image
4
● <ul>: Unordered list
3
● <ol>: Ordered list
● <li>: List item
2
● <div>: Division (section of the page)
● <span>: Inline container (section within a paragraph)
1
. HTML attributes:- HTML attributes provide additional information about an element. They
are included in the opening tag of the element and consist of a name and a value. Some
common HTML attributes include:
4
● href: Specifies the URL of a link (<a>)
● src: Specifies the URL of an image (<img>)
● alt: Specifies alternative text for an image (<img>)
● class: Specifies a class name for an element (used for styling with CSS)
● id: Specifies a unique ID for an element (used for targeting with JavaScript)
. Creating links:- Links are an important part of web pages, as they allow users to navigate
between pages and sites. To create a link in HTML, use the <a> element and the href
attribute. For example:
<a href="http://www.example.com">Link text</a>
. Adding images:- Images can be added to web pages using the <img> element and the src
and alt attributes. For example:
. <img src="image.jpg" alt="Description of image">
. Creating lists:- Lists can be created using the <ul> and <ol> elements for unordered and
ordered lists, respectively, and the <li> element for list items. For example:
. <ul>
. <li>List item 1</li>
. <li>List item 2</li>
. <li>List item 3</li>
. </ul>
. Adding styles:- HTML provides some basic styling options, such as font size and color, but
more advanced styling is typically done with CSS (Cascading Style Sheets). To add inline
styles to an element, use the style attribute. For example:
. <h1 style="color: red; font-size: 24px;">Heading 1</h1>
. Validating HTML:- It is important to ensure that your HTML code is valid and well-formed.
You can use online validators such as the W3C Markup Validation Service

You might also like