1. HTML Tags:
Definition,
HTML tags are the fundemental components of HTML syntax. They're enclosed in angle brackets ('<>') and are used to define the structure of an HTML document. Tags typically come in pairs – an opening tag and a closing tag – with content nested between them. The opening tag indicates the beginning of an element, and the closing tag denotes the end.
Example,
In this example, '<p>' is the opening tag, and '</p>' is the closing tag, encupsulating the paragraph content.
Common HTML Tags:
- '<html>': Defines the root element of an HTML document.
- '<head>': Contains meta- information about the HTML document, such as title and links to stylesheets.
- '<body>': Encloses the content of the HTML document, including textbook, images, and othe elements.
- '<h1> to <h6>': Headings of different levels, with '<h1>' being the highest and '<h6>' the lowest.
- '<p>': Represents a paragraph.
- '<a>': Creates hyperlinks, linking to other web pages or resources.
- '<img>': Embeds images into the document.
- '<ul>': Defines an unordered list.
- '<ol>': Defines an ordered list.
- '<li>': Represents a list item.
2. HTML Elements:
Definition,
An HTML element is a complete set of tags and content, working together to define a specific part of a web page. Each HTML element consists of an opening tag, content, and a closing tag. Some elements are self- closing and dont require a closing tag.
Example,
In this example, ''<a>" is the opening tag, ''</a>" is the closing tag, and the text " Visit our website" is the content of the anchor element, creating a hyperlink.
Common HTML Elements:
- ''<a>" ( Anchor Element):
- Attributes: 'href' ( specifies the URL).
- Usage: Creates hyperlinks.
- '<img>' ( Image Element)
- Attributes: 'src' ( specifies the image source), 'alt' ( provides necessary text for accesbility).
- Usage: Embeds images into the document.
- ''<p>" ( Paragraph Element)
- Usage: Represents a paragraph.
- '<h1> to '<h6>' ( Heading elements)
- Usage: Defines headings of different levels.
- '<ul>' ( Unordered List Element)
- Usage: Defines an unordered list.
- '<div>' ( Division Element)
- Usage: Defines a generic container to group other Elements.
- '<span>' ( Inline Container Element)
- Usage: Defines a generic inline Container.
These example represent just a fraction of the multitude of HTML elements available for structuring and presenting content on the web.
Tags:
30 days of HTML