Html basic tags with code💯 example✔

 here are some of the most commonly used HTML elements, along with a brief description and an example of how to use them in an HTML page:

  1. <html> - The HTML document starts and ends with this tag. This tag is used to enclose all the other HTML tags within it. Example:
php
<!DOCTYPE html> <html> <head> <title>My Webpage</title> </head> <body> <h1>Welcome to my webpage</h1> <p>This is my first HTML page</p> </body> </html>
  1. <head> - This tag is used to define the head section of the HTML document. It contains information such as the title, meta tags, links to CSS files, etc. Example:
php
<head> <title>My Webpage</title> <meta name="description" content="A description of my webpage"> <link rel="stylesheet" href="styles.css"> </head>
  1. <title> - This tag is used to define the title of the HTML document, which appears in the browser's title bar. Example:
php
<head> <title>My Webpage</title> </head>
  1. <body> - This tag is used to define the body section of the HTML document. It contains all the content that is displayed on the webpage. Example:
css
<body> <h1>Welcome to my webpage</h1> <p>This is my first HTML page</p> </body>
  1. <h1> to <h6> - These tags are used to define headings of different levels. <h1> is the highest level, and <h6> is the lowest level. Example:
css
<h1>Main Heading</h1> <h2>Sub Heading</h2> <h3>Sub-Sub Heading</h3>
  1. <p> - This tag is used to define paragraphs of text. Example:
css
<p>This is a paragraph of text.</p>
  1. <a> - This tag is used to define hyperlinks. It can be used to link to other webpages, or to specific sections within the same webpage. Example:
php
<a href="https://www.google.com">Visit Google</a>
  1. <img> - This tag is used to display images on the webpage. Example:
php
<img src="image.jpg" alt="An image">
  1. <ul> and <li> - These tags are used to create unordered lists. <ul> defines the list, and <li> defines each item in the list. Example:
css
<ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul>
  1. <ol> and <li> - These tags are used to create ordered lists. <ol> defines the list, and <li> defines each item in the list. Example:
css
<ol> <li>First item</li> <li>Second item</li> <li>Third item</li> </ol>
  1. <table> - This tag is used to create tables on the webpage. Example:
css
<table> <tr> <th>First Name</th> <th>Last Name</th> <th>Age</th> </tr> <tr> <td>John</td> <td>Doe</td>
  1. <form> - This tag is used to create forms, which allow users to input data. Example:
php
<form> <label for="name">Name:</label> <input type="text" id="name" name="name"><br><br> <label for="email">Email:</label> <input type="email" id="email" name="email"><br><br> <input type="submit" value="Submit"> </form>
  1. <input> - This tag is used to create input fields in a form. The type attribute is used to specify the type of input field (text, email, password, etc.). Example:
python
<input type="text" id="name" name="name"> <input type="email" id="email" name="email"> <input type="password" id="password" name="password">
  1. <button> - This tag is used to create buttons on the webpage. Example:
css
<button>Click me</button>
  1. <div> - This tag is used to group elements together into a block-level container. It is often used to apply CSS styles to a group of elements. Example:
css
<div class="container"> <h1>Main Heading</h1> <p>This is a paragraph of text.</p> </div>
  1. <span> - This tag is used to group inline elements together. It is often used to apply CSS styles to a group of inline elements. Example:
css
<p>My favorite color is <span style="color: blue;">blue</span>.</p>
  1. <br> - This tag is used to create a line break (i.e., move to the next line). Example:
php
<p>This is the first line.<br>This is the second line.</p>
  1. <hr> - This tag is used to create a horizontal line. Example:
php
<p>This is some text.</p> <hr> <p>This is some more text.</p>
  1. <meta> - This tag is used to include metadata in the HTML document, such as keywords, description, and author information. Example:
php
<meta name="keywords" content="HTML, CSS, JavaScript"> <meta name="description" content="This is a description of my webpage."> <meta name="author" content="John Doe">
  1. <script> - This tag is used to include JavaScript code in the HTML document. Example:
php
<script> alert("Hello, world!"); </script>

These are just a few examples of the many HTML elements available. There are many more tags and attributes that can be used to create complex and interactive webpages.

Post a Comment (0)
Previous Post Next Post