Learn HTML the Best Way - Free HTML Tutorials & Online Tag Guides

For beginners who want to develop their careers in web development, HTML is the first part of the journey. I recommend being passionate about your studies and delving deep into problem-solving.

img


Let’s learn about some important and commonly used HTML tags:

  1. Document Declaration: Initially, we declare <!DOCTYPE html>, which specifies the document type we are using.

  2. Tags Structure: Note that while using tags, they have an opening tag (<div>) and a closing tag (</div>). HTML tags are mostly used for SEO.

  3. Use of <html> Tag:

    • Document Structure: The <html> tag defines the beginning and end of an HTML document, encapsulating all other elements.
    • Namespace Declaration: It often includes the lang attribute to declare the language of the document, which can help with accessibility and search engine optimization (SEO).
    • Metadata and Content Separation: Inside the <html> tag, the document is typically divided into two main sections:
      • <head>: Contains meta-information about the document, such as its title, character set, styles, scripts, and other meta tags.
      • <body>: Contains the actual content of the document, including text, images, links, and other media.
  4. Other Common Tags:

    • Heading Tags: <h1>, <h2>, <h3>, etc. <h1> is the largest heading tag, while <h2> is smaller than <h1>, and so on.
    • <h1>This is a Heading</h1>
      <h2>This is a Subheading</h2>
    • Paragraph Tag: <p> is used to write content.
    • <p>This is a paragraph.</p>
    • Horizontal Rule: <hr /> is a self-closing tag used for creating a horizontal line.
    • <hr />
    • Line Break: <br /> is a self-closing tag used for creating line breaks.
    • <br />
    • Input Tag: <input type="name" placeholder="Enter Your Name" required /> is also a self-closing tag. The type attribute specifies the type of input (e.g., name, password, email). The placeholder attribute displays a placeholder in the input box, and required ensures the input cannot be left empty.
    • <input type="text" placeholder="Enter Your Name" required />
  5. Table Tags:

    • Table Structure: The <table> tag defines a table. Inside a table, we use <tr> for table rows, <th> for table headers, and <td> for table data cells.
    • <table>
          <tr>
              <th>Header 1</th>
              <th>Header 2</th>
          </tr>
          <tr>
              <td>Data 1</td>
              <td>Data 2</td>
          </tr>
      </table>
    • Table Caption: The <caption> tag is used to add a caption to the table.
    • <table>
          <caption>Table Caption</caption>
          <tr>
              <th>Header 1</th>
              <th>Header 2</th>
          </tr>
          <tr>
              <td>Data 1</td>
              <td>Data 2</td>
          </tr>
      </table>

Next Post Previous Post
No Comment
Add Comment
comment url