About Lesson

HTML Elements and Tags

Basic HTML tags

Here are some basic HTML tags that you can use to create a web page:

  • <html>: This tag defines the root of an HTML document.
  • <head>: This tag contains information about the document, such as the title, metadata, and links to CSS files.
  • <title>: This tag specifies the title of the document, which is displayed in the browser’s title bar.
  • <body>: This tag contains the visible content of the web page, such as text, images, videos, and other HTML elements.
  • <h1>, <h2>, <h3>, <h4>, <h5>, <h6>: These tags are used to create headings of different levels on the web page.
  • <p>: This tag is used to create paragraphs of text.
  • <img>: This tag is used to display images on the web page.
  • <a>: This tag is used to create hyperlinks to other web pages or resources.
  • <ul>, <ol>, <li>: These tags are used to create bulleted and numbered lists.
  • <div>, <span>: These tags are used to group and format content on the web page.

These basic HTML tags provide a foundation for creating a simple web page. By using these tags and adding content, you can create a basic HTML document that can be viewed in a web browser.

HTML attributes

HTML attributes are used to provide additional information about an HTML element. They are used to modify the behavior or appearance of an element, or to provide extra information to the browser.

Here are some common HTML attributes:

  • Class: this attribute is used to specify one or more class names for an element, which can be used to style the element with css.
  • Id: this attribute is used to specify a unique identifier for an element, which can be used to reference the element with javascript or css.
  • Style: this attribute is used to specify inline css styles for an element.
  • Src: this attribute is used to specify the url of an external resource, such as an image or a video.
  • Href: this attribute is used to specify the url of a hyperlink.
  • Alt: this attribute is used to provide alternative text for an image, which is displayed if the image cannot be loaded or if the user is using a screen reader.
  • Title: this attribute is used to provide a title or tooltip for an element, which is displayed when the user hovers over the element with their mouse.
  • Width and height: these attributes are used to specify the width and height of an element, such as an image or a table.
  • Target: This attribute is used to specify where to open the linked document or resource, such as in a new window or tab.

HTML attributes are an important part of creating dynamic and interactive web pages. By using attributes, you can add functionality and customization to your HTML elements.