HTML Elements

Element in HTML

An HTML file is made of HTML Elements. These elements are responsible for creating web pages and define content in that webpage. An element in HTML usually consists of:

i.start tag.
ii. attributes.
iii. end tag.


Example:

<!DOCTYPE html>
<html>
<head>
<title>WebPage</title>
</head>
<body>
<h1>This is my first web page</h1>
<h2> How it looks?</h2>
<p>It looks Nice!!!!!</p>
</body>
</html>

Types of Elements:

In HTML most of the element are defined as block level or inline Element.

Block Level Element:

Block Level element starts from new line and takes the full width of web page, from left to right.
These are the elements, which structure main part of web page, by dividing a page into coherent blocks.

Some of the block-level element are:

• <h1-h6>
* <form>
• <li>
* <ol>
• <ul>
* <p>
• <pre>
* <table>
• <div>
* <article>
• <aside>
* <footer>
• <dd>
* <dl>
• <header>
* <main>
• <section>
* <label>
• <form>
* <tfoot>


Example:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style=”background-color: lightblue”>This is first div</div>
<div style=”background-color: lightgreen”>it is second div</div>
<p style=”background-color: pink”>This is a block level element</p>
</body>
</html>

Inline Element :

These element are normally displayed without line breaks.
Inline elements are those elements, which differentiate the part of a given text and provide it a particular function.

Some of the block-level element are:

• <b>
* <a>
• <strong>
* <img>
• <input>
* <em>
• <span>
* <abbr>
• <big>
* <br>
• <button>
* <sub>
• <sup>
* <time>
•<textarea>
* <var>
• <select>
* <script>
• <code>
* <map>
• <bdo>
* <acronym>
• <samp>
* <label>


Example:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<a href=”https://www.AskAtul.com”>Click on link</a>
<span style=”background-color: lightblue”>this is inline element</span>
<p>This will take width of text only</p>
</body>
</html>

Other element can be used either as block level or inline element. They are:

1. APPLET: embedded java applet.
2. IFRAME: Inline frame.
3. INS: inserted text.
4. MAP: image map.
5. OBJECT: embedded object.
6. SCRIPT: script with an HTML document.


Recommended Posts:

Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *