Comments , Tags , Attributes (lt3)

himanshuhimanshu
2 min read

Comment : cntrl+/ (in vs code) Comments in HTML are not visible to website visitors; they are meant for developers and designers. Comments are useful for adding notes, explanations

Tags: There are several types of tags that serve different purposes and define the structure and content of a webpage. They enclose content and provide structural information.

  • Tags are always enclosed within angle brackets <>

  • There are two kinds of HTML tags: paired {opening <> and closing <\> }and unpaired { self closing}.

Elements: An element consists of the opening tag<>, content, and the closing tag</> .Elements can be as simple as a single word or as complex as an entire webpage.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title> lt 2 </title>
  </head>
  <body>
   <!-- this is comment  -->
<> </>  //  (  a paired tag)
<> content </> //  ( this is called element>
</body>
</html>

Attributes: In simple words additional property of a tag to increase its power is called attribute. They are placed within the opening tag.

Attributes can be used to specify things like the source of an image, the destination of a link, or the styling of an element.

ex : <img src="source of image" alt=" if image not loaded then what to show">

lt2 : https://hashnode.com/post/clnl9ap3x000309k0h3r36mr7

0
Subscribe to my newsletter

Read articles from himanshu directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

himanshu
himanshu