0% found this document useful (0 votes)
9 views4 pages

HTML Basics and Tag Usage Guide

HTML is a markup language essential for creating web pages, with key elements including the document type declaration, root HTML tag, and various tags for content structure such as headings, paragraphs, and links. Attributes enhance HTML elements by providing additional information, while formatting elements allow for text styling. The document also covers the use of tables and forms in HTML for organizing data and user input.

Uploaded by

Taliyah
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)
9 views4 pages

HTML Basics and Tag Usage Guide

HTML is a markup language essential for creating web pages, with key elements including the document type declaration, root HTML tag, and various tags for content structure such as headings, paragraphs, and links. Attributes enhance HTML elements by providing additional information, while formatting elements allow for text styling. The document also covers the use of tables and forms in HTML for organizing data and user input.

Uploaded by

Taliyah
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 is a Mark-up Language and not officially a programming language.

“! DOCTYPE” is used to declare the version of HTML.


The HTML tag is the root element and it is essential for all other tags to function.
An Element is in the form of <…> content </…>
The head tag refers to the web-document tab, and contains the Meta information
of the HTML page.
The Title tag specifies the Title name of the HTML Page.
The body tag contains the main contents of a web page.
H1-H6 are heading tags. It is arranged in descending order of importance. H1-
Most important, and H6- Least important.
The ‘P’ tag is the Paragraph tag.
The ‘br’ tag is used to break a line and start a new line.
The ‘hr’ tag is used to create a horizontal rule/line.

The HTML links start with an <a> for anchor.


The syntax is <a href=”link”> Content </a>.

Attributes are used to add more information about HTML elements.


An example of an attribute is displayed below:
This is a normal tag: <img>
This is a tag with Attributes: <img src=”[Link]” alt=”alternative text if image
can’t be found” width=”size” height=”size”>
This is a normal tag: <h2>
This is a tag with Attributes: <h2 title=”header”></h2>

There are two types of URL:


ABSOLUTE- other images hosted on the internet.
RELATIVE- our images hosted on the website.

Normal tags have an opening tag and a closing tag. <p> and </p>.
Empty tags have only an opening tag and no closing tags. E.g. <br>.
 HTML is NOT case sensitive.
 Never skip a closing tag.
The Style Attribute is used to add styles to an element, such as font, size, color,
etc.
The title attribute is used to define extra information about an element.
The lang attribute is used to determine the language.
We use double quotations for quotes or for attribute specifications.

The pre tag is for defining preformatted text.


The style attributes:
- Background-colour
- Color
- Font-family
- Font-size
- Text-Align

Formatting elements:
 <b> for bold text
 <strong> for important text
 <i> for italic text
 <em> for emphasized text
 <mark> for marked text
 <small> for smaller text
 <del> for deleted text
 <ins> for inserted text
 <sub> for subscript text
 <sup> for superscript text

To comment:
<!- - Comment - - >

To link an email address:


<a href=”mailto: somoneon@[Link]”> Send email </a>

To add a favicon (images near the website title): (you can get favicons from
[Link])
<link rel=”icon” type=’Image” href=”../PlaceOfFile”>
Tables!!!
<Table>
<Thead>
<tr> Very first row/ Header row
<th>First table head</th>
<th>second table head</th>
</tr>
</Thead>

<tr> Second row


<td>first table data</td>
<td> second table data</td>
</tr>

<tr> Third row


<td>first table data</td>
<td> second table data</td>
</tr>

</Table>

Forms!!!
(For following webpage after form, use action)
<form action=”Next Webpage”>
Otherwise use normal form

<form>
//Labels for textboxes
<label for=”text”> LabelName: </label>

//Input text box


<input type=”text” id=”LabelName” name=”LabelName”>
<input type=”l

</form>

Common questions

Powered by AI

The 'lang' attribute specifies the language of the text in an HTML document, contributing significantly to accessibility and usability by enabling screen readers to accurately render pronunciation and intonation for visually impaired users . It also aids search engines in determining the language of the content, improving the visibility of the webpage in relevant queries, and enhances user experience by providing the correct localization, ensuring that users receive content in their preferred language .

HTML tables, structurally defined by <table>, <tr>, <th>, and <td> tags, are used to present tabular data in an orderly and accessible manner . They are ideal for displaying structured data like schedules or comparison lists. However, modern web practices often prefer CSS for layout design to separate content from presentation. While tables are still appropriate for static data representation, complex layouts have shifted toward using div and CSS flexbox/grid models. This evolution reflects the importance of responsive design and a focus on accessibility and maintainability, ensuring that web content is more adaptable across varied devices .

The 'a' tag, used for hyperlinks, is fundamental for web navigation, facilitating the linking of documents across and within webpages . It enhances usability by enabling users to navigate through related content intuitively, providing paths to further information or actions. From an SEO perspective, links help search engines understand the structure and relevance of a website's content. Internal links distribute SEO value throughout the site, improving crawlability, while external links can confer authority and trustworthiness if linked to reputable sources .

HTML comments are implemented using the syntax "<!-- Comment -->" and are crucial for documentation within the code . They serve as notes to developers, explaining code functionality, marking sections of the code, or temporarily disabling code without removing it. Comments are ignored by browsers, making them invisible on the rendered page. This allows for collaborative development and future maintenance as they enhance code readability and understanding without affecting the web page output .

HTML attributes add additional information to HTML elements, enhancing their functionality by modifying appearance and behavior. For example, the "style" attribute can change the visual presentation by specifying CSS properties like "color" or "font-size" (e.g., <p style="color: red;">). The "src" and "alt" attributes in an <img> tag specify the source of an image and alternative text for accessibility, respectively, directly affecting the image's rendering and informational value (e.g., <img src="image.jpg" alt="A descriptive text">). Other attributes like "href" in an <a> tag dictate the behavior by defining the link target location (e.g., <a href="http://example.com">).

Heading tags (H1-H6) provide structure to web content, with H1 being the most important and H6 the least, used to create a hierarchy of importance . For user experience, they help organize content, making it more readable and navigable. For SEO, they assist search engines in understanding the content hierarchy and context, as headings are often scanned for keywords and critical information. Proper use of heading tags can improve a page's relevance to search queries and accessibility, leading to better search rankings and user interaction .

The 'style' attribute in HTML allows for inline styling of elements, enabling the immediate application of CSS properties directly within the HTML tag . It customizes the appearance of a webpage by specifying styles such as background-color, font-size, and text-align. For instance, <p style="color: blue; font-size: 14px;"> applies specific text color and font size to a paragraph. This attribute offers convenience for quick styling changes, though extensive styling is better managed through external or internal CSS for maintainability and separation of concerns .

Absolute URLs provide the full path to a resource as they link to items hosted on the internet, including the full website path (e.g., "http://example.com/image.jpg"). Relative URLs, on the other hand, only specify a path relative to the domain or current document, making it simpler to manage links within a website (e.g., "/images/photo.jpg"). Developers might choose relative URLs for resources within the same site to make the site more flexible to maintain, especially when migrating to different domains, while absolute URLs are preferred for linking to external resources .

HTML normal tags consist of an opening and a closing tag, surrounding the content, such as <p>content</p> . Empty tags, like <br>, do not enclose content and have only a single tag . Understanding this distinction is important for correctly structuring HTML documents and ensuring that elements render as intended. Incorrect nesting or use may lead to rendering errors or unexpected behavior on the webpage .

The "!DOCTYPE" declaration is used to specify the version of HTML that the webpage is written in. It helps the browser understand how to render the page correctly by indicating the document type. Without it, browsers may enter "quirks mode," where pages are displayed with less consistency across different browsers. Using "!DOCTYPE" ensures that the HTML page is rendered using standards mode, leading to more predictable results across different platforms and browsers .

You might also like