The structure of HTML and some basic tags

The structure of HTML

·        The structure of HTML  defined by a set of nested tags like html ,head and a body tag .

What is tag?

  • Tags are used to create elements, such as paragraphs, headings, links, images, and tables.
  •  It is made up of the pair < ​​(less than sign)> (greater than sign).
  •  Most HTML tags have an opening tag and a closing tag.
  • The closing tag has the same text as the opening tag, but with an extra forward-slash (/) character.
Structure of html 

<html>

<head><title>title</title></head>

<body>

</body>

</html>

Structure components 

  • <!DOCTYPE html>: Declares the document as an HTML document.
  • <html>: It is the root element of an HTML page.
  • <head>: It contains meta information about the page.
  • <title>: Display the title of the page.
  • <body>: Contains the main content of the page.

Some Example with various tags



HTML Attributes:

HTML elements can be modified by attributes. Attributes are placed within the opening tag in an element.

 For Example: bgcolor is an attribute of body tag which displays background color of your page.

Example:1

<html>

<head><title> MY first page </title></head>

<body bgcolor=”green”>

<h1>WEL_COME</h1>

</body>

</html>

OUT-PUT



<h> tag

<p>tag: The <p>tag is intended specifically to hold paragraphs of text.

&nbsp: nbsp stand for non-breaking space, it allows a space

Example:2

<html>

<head><title> MY  page </title></head>

<body bgcolor="auqua">

<h1>what is html?</h1>

<p>&nbsp&nbsp html stand for hypertext markup language</p>

</body>

</html>

OUT-PUT


Marquee tag

·         The <marquee> tag allows us to make text or images move across a webpage, creating a dynamic effect. 

 Example:3

<html>

<head><title> MY  page </title></head>

<body >

<marquee>

<h1>I am good</h1></marquee>

</body>

</html>

<b><i><u><br> tag: it displays the bold ,italic, underline text and on next(new) line respectively.

Example:4

<html>

<head><title> MY  page </title></head>

<body bgcolor="aqua">

<b><h1>I am good</b>><br>

<I>I am good</i>><br>

<u>I am good</u>><br>

</body>

</html>

OUT-PUT



Anchor  or <a> tag : <a> tag used to create hyperlinks between web pages or to different sections within a single page.

With herf attribute creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.

Example:5

<html>

<head><title> MY  page </title></head>

<body>

<a href=”p1.html”> Wel-come </a>

</body>

</html> 

<Img> tag

The <img> tag gives us the ability to embed an image on our web page with its src attribute.
Attributes of img tag
src: provides us the source address of to be embedded image.
alt: Allows us the display the alternative text for the image.
Height and width: It is used to specify the area of the image.
Example:
<html>
<head><title>my image</title></head>
<body>
<img src="p1.jpg" width="500" height="500">
</body>
</html>

OUT-PUT




Comments

Popular posts from this blog

Frame tag and Example

Introduction and objective of HTML