Basic elements
HTML Element
An HTML element is defined by a start tag followed by some data and an end tag.
<tag> your data here...</tag>
HTML Tag
HTML tags are like hidden keywords which define how your web browser formats and display the data with in a web page.
Usually tags contains an opening and a closing part. For example, <h1>
is the opening tag and </h1>
is the closing tag. Both opening and closing tags must share same tag name. Never forget the closing tag as it may produce unexpected results if not provided.
There are some exceptions where tags may not have closing tag like <img />
, <br/>.
HTML Attribute
HTML attributes allow you to provide additional information about the elements like you are customising a HTML tag, and are defined within the opening tag. In the below example src
is an attribute to <img>
tag.
<img src="image.jpg"/>
Headings
HTML headings are used to define a title or a subtitle which you want to display on the webpage.
<h1>
, <h2>
, <h3>
, <h4>
, <h5>
, <h6>
are the heading tags in HTML with <h1>
defines the most important heading and <h6>
defines the least important heading.
<!DOCTYPE html>
<html>
<head>
<title>Headers</title>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
</html>
Try yourself here
Paragraph
<p>
is used to define HTML paragraphs which contains a block of text. Usually paragraphs starts on a new line.
<p>
Line 1
Line 2
Line 3
.....
</p>
HTML formatting
Formatting Elements | Description |
---|---|
<i>..</i> | Italic |
<u>..</u> | Underline |
<b>..</b> | Bold |
<strong>..</strong> | Important text |
<em>..</em> | Emphasized text |
<mark>..</mark> | Marked text |
<small>..</small> | Smaller text |
<del>..</del> | Deleted text |
<ins>..</ins> | Inserted text |
<sub>..</sub> | Subscript text |
<sup>..</sup> | Superscript text |