CodesJava

Easy learning with example program codes

HTML Elements

An element in an HTML document can be understood as an individual component of an HTML file. In more simple words, the elements are everything written within tags, including the tags, attributes and the contents.

Basic elements used in HTML are:

<h1> ...... <h6>Content</h1> ...... </h6>

They are used to specify the headings of page.

<p>Content</p>

It is used to specify a content as a paragraph.

<div>Content</div>

It is used to specify a section in web page.

<br>

It is used to specify a line break.

<hr>

It is used to specify a horizontal line.

Example:

<!DOCTYPE>  
<html>  
<head>  
<title>Example</title>  
</head>  
<body>  
<h1 style="color: red">Hello</h1>  
<p style="color: blue">World!!</p>  
</body>  
</html>

Output:

  
  
  
Example  
  
  

Hello

World!!

Void Elements:
Elements with no contents and end tags are called Void or empty elements. Example
and


Nested HTML Elements:
An element containing another element is called the Nested HTML Element.

Block-level element:
Elements which structure the main part of the web page is the Block-level element. It divides a page into coherent blocks and takes the full width of the web page, from left to right. It always starts with a new line.

The block-level elements in HTML are:

<address>, <article>, <aside>, <blockquote>, <canvas>, <dd>, 
<div>, <dl>, <dt>, <fieldset>, <figcaption>, <figure>, <footer>, 
<form>, <h1>-<h6>, <header>, <hr>, <li>, <main>, <nav>, <noscript>, 
<ol>, <output>, <p>, <pre>, <section>, <table>, <tfoot>, <ul>, <video>

Inline elements:
Elements which differentiate the part of a given text is called an Inline element. It also provides a particular function to the differentiated part of the text, and take width as per requirement. It does not start with a new line and is mostly used with some other elements.

The inline elements in HTML are:

<a>, <abbr>, <acronym>, <b>, <bdo>, <big>, <br>, <button>, <cite>, 
<code>, <dfn>, <em>, <i>, <img>, <input>, <kbd>, <label>, <map>, 
<object>, <q>, <samp>, <script>, <select>, <small>, <span>, <strong>, 
<sub>, <sup>, <textarea>, <time>, <tt>, <var>
Please follow and like us:
error
Posted in HTML   









Copyright © 2019 CodesJava DMCA.com Protection Status