HTML introduction

HTML introduction

HTML

HTML stands for Hyper Text Markup Language. HTML is standard markup language for creating web pages.

It consists of variety of elements through which the user is able to write content to it. we use different elements for writing different things like -

  • For heading we use - h1, h2, h3, h4, h5, h6

  • For writing title of page we use - title

  • For writing paragraph we use - p

All these are nested in tags for use, for example

<tagname>content</tagname>

first tag is for starting the element and second tag is to end the element

Structure of html

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <link rel="icon" type="image/x-icon" href="/images/favicon.ico">
</head>
<body>

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

</body>
</html>

explanation to example

  • <!DOCTYPE html> - declaration defines that this document is an HTML5 document
  • <html> - element is the root element of an HTML page
  • <head> - element contains meta information about the HTML page
  • <title> - element specifies a title for the HTML page
  • <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> - element defines a large heading
  • <p> - element defines a paragraph.
  • <link> - this is used to link some file. in this we are giving icon to the title of page

HTML also has attributes in elements

which are used to specify some data Attributes provide additional information about elements Attributes are always specified in the start tag Attributes usually come in name/value pairs like: name="value" for example

<a href="https://www.google.com">Visit google</a>

The <a> tag defines a hyperlink. The href attribute specifies the URL of the page

we have different types of attributes for different purposes

  • class - to make elements different from same elements by assigning some different properties
  • id - works same as class
  • charset - through which we can put some emoji's in html page
  • href - in which we can store a link
  • src - to store image filepath