Skip to main content

HTML

HTML (HyperText Markup Language) is the standard markup language used to create web pages. It provides a structure for the content on a web page, including headings, paragraphs, lists, links, images, and more. HTML is a markup language, meaning it uses tags to annotate text, images, and other content, to describe how it should be displayed in a web browser. To create a web page using HTML, the code is written in a text editor, saved with an .html extension, and then opened in a web browser to view the results.

What is HTML ?

  1. Building block of webpage.
  2. Provide description of webpage.
  3. Skeleton of webpage.

Random Questions

  1. What are two ways to open HTML doc?

    1. Text Editor.
    2. By Browser.
  2. Which website is best to explore HTML tags?

    1. MDN : https://developer.mozilla.org/en-US/docs/Web/HTML/Element

Tags

Tags is annotation used for defining how to render different element on webpage. To see examples of tags click here

Structure of tag

[               ELEMENT                         ]
[<h1> Namaste Dunia </h1> ]
[Opening tag Content Closing Tag]

Empty tags or self closing tags

Self-closing tags in HTML are sometimes also known as empty tags, void tags, singletons tags, etc. This means that these tags have no content and cannot have any children.

Examples:

1.  <br/>
2. <img/>
3. <input/>

Random Questions

  1. What is diff between p tag and div tag?

    A p tag is for a paragraph, generally used for text. A div tag is for division, and generally used for creating sections of text.

  2. What happens when we close an empty tag?

    Adding the closing tags to the empty elements will be invalid syntax. The empty elements don't have any child nodes. In short, Empty elements are self-closing or void and not container tags. The empty elements are used to embed images, lists, breaks, horizontal lines, hyperlinks, for input, meta-data, area, etc.

IMPORTANT

  1. Tags are not case sensitive.
  2. There are 100+ HTML tags available.

HTML Text Elements

There are two types of html text elements.

  1. Block Elements
  2. Inline Elements

Block Elements

Few examples of block elements

1.  Paragraph   <p>
2. Heading <h1>
3. list <ul> | <ol>
4. Article <article> | <section>
...

Inline Elements

An inline element does not start on a new line. An inline element only takes up as much width as necessary.

They are used to differentiate specific part of text

Few examples of Inline elements

1.     <em>
2. <strong>
3. <a>
4. <img>
...

HTML Lists

There are 3 types of HTML lists

1.  ordered list
2. unordered list
3. description list

Attributes

All html elements can have attributes Can have in opening tag only provide addtional info about element