0% found this document useful (0 votes)
8 views2 pages

Comprehensive HTML Tags Guide

The document defines and describes common HTML tags such as <!DOCTYPE>, <html>, <head>, <title>, <body>, <h1>, <p>, <br>, <center>, <marquee>, font tags, image tags, and hyperlinks. It provides details on how each tag is used and what purpose it serves in an HTML document.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Comprehensive HTML Tags Guide

The document defines and describes common HTML tags such as <!DOCTYPE>, <html>, <head>, <title>, <body>, <h1>, <p>, <br>, <center>, <marquee>, font tags, image tags, and hyperlinks. It provides details on how each tag is used and what purpose it serves in an HTML document.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

HTML tags

<!DOCTYPE html>: All HTML documents must start with a <!


DOCTYPE> declaration. The declaration is not an HTML tag. It is
an "information" to the browser about what document type to
expect.

To add a background color


<body style="background-color:grey">

<html> </html>It is the root of the html document which is used to


specify that the document is html. All other code is placed between
the opening and closing of this tag.

<head> </head> This tag contains all the metadata and this data
is related to the document and is not displayed on the actual
webpage.

<title> </title> defines a title in the browser toolbar.

The <body> tag defines the document's body. The <body> element
contains all the contents of an HTML document, such as headings,
paragraphs, images, hyperlinks, tables, lists, etc

<h1> </h1> Any document starts with a heading. You can use
different sizes for your headings. HTML also has six levels of
headings, which use the elements <h1>, <h2>, <h3>, <h4>, <h5>,
and <h6>. While displaying any heading, browser adds one line
before and one line after that heading.

<p> </p> The <p> tag offers a way to structure your text into
different paragraphs. Each paragraph of text should go in between
an opening <p> and a closing </p> tag

<br> Whenever you use the <br /> element, anything following it
starts from the next line.

<center> </center> You can use <center> tag to put any content in
the center of the page
The HTML <marquee> tag defines a scrolling text area in the HTML
document that moves across the page in a horizontal or vertical
direction. By default, text found within the <marquee> tag will
scroll from right to left.

Font tag: It is used to specify the font size, font color and font
family in html document. E.g. <font face="Times New
Roman">Example</font>

Image tag <img src="[Link]">

Hyperlinks The HTML <a> tag defines a hyperlink. <a


href="url">link text</a>

Common questions

Powered by AI

Using inline styling for background colors within the <body> tag, such as <body style="background-color:grey">, allows for quick customization of webpage aesthetics. However, this approach violates modern best practices, which recommend separating content (HTML) from presentation (CSS). Inline styles can lead to cluttered HTML code and make it difficult to manage and update styles across multiple pages. Instead, using an external CSS stylesheet is advocated for maintainability, reusability, and enhancing the scalability of web design .

Hyperlinks, created using the <a href="url">link text</a> tag, are integral to web navigation and user experience, providing pathways for users to access related content within the same or different websites. They facilitate the non-linear traversal of information, thereby supporting the interactive nature of web browsing. Proper use of hyperlinks enhances the usability of a site by allowing users to navigate intuitively across a web page or between pages. For optimal user experience, descriptive and meaningful link texts should be used, improving accessibility and helping users understand where a link will take them .

The <p> tag is used to organize text into separate paragraphs, enhancing readability by providing clear visual breaks in text content. This structure facilitates not only a logical flow of text but also improves user experience by making the text more digestible and easier to scan. By encapsulating blocks of text within paragraph tags, webpages can present information in a structured, coherent manner that engages readers effectively .

The <!DOCTYPE html> declaration informs the browser about the type of document to expect, ensuring it is processed correctly. This declaration is not an HTML tag but a preamble to tell the browser the version of HTML being used, which helps in rendering the document correctly. Unlike HTML tags which define elements of the webpage, <!DOCTYPE html> serves as an instruction to the browser for proper interpretation of the HTML syntax and structure .

The <marquee> tag creates a scrolling text effect and was used to add dynamic styling to text. However, it is considered deprecated and non-standard because it does not conform to the HTML standard of separating content from style. Modern HTML practices encourage the use of CSS for any type of animation or styling to ensure compatibility across browsers and accessibility for all users. Using <marquee> can lead to unpredictable behavior across different web browsers and devices, and it may negatively impact accessibility, as screen readers may not handle scrolling text properly .

Heading tags (<h1> to <h6>) structure the content of a webpage, creating a hierarchical order that outlines the importance of each section, akin to an outline format. <h1> is the highest level and usually represents the main heading, while <h6> represents the lowest level of heading. Using these tags correctly not only organizes the content logically but also improves accessibility for users, particularly for those using screen readers, as they rely on this structure to navigate the content efficiently. Moreover, properly structured headings can enhance SEO by providing search engines with a clear understanding of content hierarchy and relevance .

The <img src='gfg.jpg'> tag in HTML is responsible for embedding images into a webpage by specifying the source file location. To enhance functionality and accessibility, additional attributes like 'alt' for alternative text descriptions are recommended, offering information about the image for screen readers and search engines. Attributes such as 'width' and 'height' can optimize page loading times by setting explicit dimensions, and 'loading' attributes for lazy-loading images can further improve page performance by deferring off-screen images loading until they are needed .

The <body> tag defines the body of the HTML document and contains all the contents that will be displayed on the webpage. This includes text, images, tables, lists, hyperlinks, and anything that constitutes the main content of the webpage. The structure and appearance of the webpage are dictated by the elements placed within the <body> tag .

The <font> tag is discouraged in modern web development as it imposes inline styling directly within HTML, thereby mixing content with presentation, which contradicts the principles of separation of concerns. This practice makes maintaining and updating web styles cumbersome and less efficient. Furthermore, the <font> tag is deprecated and no longer supported in HTML5. Modern alternatives include CSS techniques, where styles are defined in stylesheets or internal stylesheets that manage typography through CSS properties like 'font-family', 'color', and 'font-size', creating a cleaner, more manageable codebase that is easier to scale and update .

HTML tags like <head> and <title> are used to enclose metadata and other information about the webpage that is not displayed on the page itself. The <head> tag contains metadata, which can include information such as the character set, page descriptions, keywords, author of the document, and viewport settings, crucial for search engine optimization and ensuring the webpage is displayed correctly on different devices. The <title> tag, within the <head>, sets the title shown on the browser tab and is used by search engines to index the page title in their search results. Proper meta descriptions can significantly influence the page's visibility in search engine results and the way the page is perceived by users .

You might also like