HTML Documents:

All HTML documents must start with a document type declaration: <!DOCTYPE html>.

The HTML document begins with <html> and ends with </html>.

The visible part of the HTML document is between <body> and </body>.

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

Where,

  • <!DOCTYPE html> Element defines document types (Like HTML5 document).
  • <html> html element define the root element of an HTML page.
  • <head> Head elements contains meta information about the HTML page
  • <title> Title element specifies a title for the HTML page.
  • <body> Body element defines the document’s body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
  • <h1> Heading element defines a large heading.
  • <p>  Paragraph element defines a paragraph.

What is the difference between tags and elements ?

Tag means the text surrounding by angular bracket is called tags.

Ex: <p> </p>

Element means the combination of tag and text is called elements.

Ex: <p> Welcome to html code</p>

HTML Attributes:

Html attribute is a word which gives additional information about html tags or elements.

Always we have to write the attribute inside the opening tag only.

Syntax: attribute name= “attribute value”

Example: align, style, href, src, alt, … etc.

Align: This attribute is used for left, right & center.

<!DOCTYPE html>
<html lang="en">
<head>
   
    <title>Attribute</title>
</head>
<body>

    <p Align = "center">Good Morning</p>
    <h1 style="color: crimson;" Align = "center">Hello World </h1>
    
</body>
</html>

Output:

Related Posts

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Artificial Intelligence