HTMLComplete Notes
HTMLComplete Notes
Single tags:
This tags will not have any closing tags they themselves are
closing and opening tags
Ex :
<!DOCTYPE html> : Describe the document type
<meta> : Meta tags in HTML provide additional information
about a web page to search engines and browsers.
Empty tags:
HTML empty tags are self-closing tags that do not need a
closing tag because they do not have any content.
Ex :
<br>: Insert a line break
<hr>: Insert a horizontal rule
<img>: Insert an image
<input>: Insert an input field
<link>: Insert a link to a CSS file or other resource
Paired tags :
Tags that have a start tag and an end tag.
Ex :
<p>, div
Semantic tags :
Tags that describe the meaning of the content they contain.
Ex :
<header>, <article>, <footer>, <table>
Non-semantic tags :
Tags that do not describe the meaning of the content they contain.
Ex :
<div>, <span>, <br>
Elements :
HTML elements are the building blocks of web pages, defined by start
and end tags, and can contain content and attributes.
1. Inline Elements :
Inline takes up only as much space as its content and does
not start on a new line. Can be used to create links, images, and other
small elements.
Ex :
<a>: Anchor link
<span>: Span element
<img>: Image element
<input>: Input field
<button>: Button
Attributes :
Every tag will have its own attributes. Using these attributes we can
customize and recognize the tags.
Ex :
Class : used to identify an tag.
Id : It works similarly to class.
Height: can customize height of the tag.
Width : can customize the width of the tag.
Global Attributes :
These attributes can be used by any tag. There are not
limited to certain tags. You can use it in the head section to the body
section.
Text Tags :
In HTML we use the text tags to edit the content in our web page. There are
different types of text tags that we use to edit the content on our page.
1. Headings: used to set headings at different levels in different sizes.
a. We have the heading tags in a range of h1 to h6.
b. The higher we go the smaller text we get.
2. Paragraph: used to write the content as a paragraph
3. Lists: used to describe the content in a list
a. Lists are two types :
i. Ordered List
ii. Unordered List
b. Every list used the <li> tag in order to specify the points.
4. Definition List: Used to make the content a definition.
a. In Definition, we have the different tags which are used to specify
the content as heading and explanation.
Ex :
dl : used to declare the declaration list
dt : used to declare the definition term
dfn : used to declare the side heading for the definition
dd : used to declare the definition data
5. Table: Used to create tables in our web page.
a. To create tables we use these tags.
Ex :
Anchor tag : .
Syntax :
Syntax :
<img>` Tag:
- The actual content being referenced (image, diagram, etc.).
- The `src` attribute specifies the URL of the content.
- The `alt` attribute provides alternative text for accessibility.
<figcaption>` Tag:
- Provides a caption for the content within the `<figure>` element.
- Describes or adds context to the content.
This structure is useful for semantic HTML and is particularly helpful for
accessibility. Screen readers, for example, can use the association between
the `<figure>` and `<figcaption>` to provide additional information about
the content to users with visual impairments.
<figure>
<code>
<pre>
// Some code snippet
function example() {
console.log("Hello, World!");
}
</pre>
</code>
<figcaption>Code snippet example</figcaption>
</figure>
<section>:
Functionality:
Represents a thematic grouping of content, typically with a heading.
Working:
It helps in organizing the content of a page into sections, making it
semantically meaningful and improving accessibility.
<header>:
Functionality:
Represents introductory content at the beginning of a section or page.
Working:
Typically used to contain headings, logos, navigation menus, and other
elements that are usually found at the top of a page or section.
<main>:
Functionality:
Represents the main content of the document.
Working:
It contains the primary content of the web page, excluding headers,
footers, and sidebars. It's intended to directly relate to or be the central focus
of the document.
<nav>:
Functionality:
Represents a section of the page dedicated to navigation links.
Working:
It's used to define a navigation menu. Inside a <nav> element, you
might find a list of links or other navigation-related elements.
<footer>:
Functionality:
Represents a footer for a section or page.
Working:
It typically contains metadata, copyright information, links to related
documents, or other information relevant to the section or page.
<span>:
Functionality:
Represents an inline container that doesn't inherently represent
anything.
Working:
It's used to apply styles or scripting to a specific part of the text
without affecting the structure. It's often used with CSS to style specific
portions of text.
<article>:
Functionality:
Represents a self-contained piece of content that could be distributed
and reused independently.
Working:
It's used for content that makes sense on its own, such as a news
article, blog post, or forum post. It often includes a heading and may contain
images, paragraphs, or other elements.
<aside>:
Functionality:
Represents content that is tangentially related to the content around it,
such as a sidebar.
Working:
It's often used for content like a sidebar, pull quote, or related links. It
is not the primary content but provides additional context or supplementary
information.
Form Tags :
This form uses the following attributes:
1. The <form> tag uses the action attribute to specify the URL of the
page where the form data will be submitted, the method attribute to
specify the HTTP method that will be used to submit the form data,
and the id attribute to specify the ID of the form.
a. In forms we have the following attributes
i. Action : defines what type of action need to perform in
that form
1. Syntax : action = “Relative URL & Absolute URL
or empty”
ii. Method : defines how the data needs to transfer.
1. Syntax : method = “GET /POST /PUT /DELETE”
a. GET : Appends form data to the URL in a query
string. Suitable for small amounts of data and
non-sensitive information.
b. POST : Sends form data in the body of the
HTTP request. Suitable for large amounts of
data and sensitive information. It is more secure
to transfer the data.
2. The <input> tags use the id, name, type, placeholder, required, max,
min, maxlength, pattern, value, size, accept, alt, checked, disabled,
readonly, src, and width attributes.
a. We use different input types to accept the input from user.
i. Text – accepts text from user
ii. Checkbox – allows user to select multiple options
iii. Radio – gives a radio button to select the between
multiple options
iv. Submit Button – acts as submit
b. We have the following attributes for input tag
i. Type : what type of input like text, checkbox, radio,…
1. Syntax : type = ” Text/ radio/ checkbox/submit/
reset/file”
ii. Name : used to identify or group the set of data together
1. Syntax : name = “DefineGrpName”
iii. Placeholder : used to give a name inside the textbox/ area
so that the user can understand what needs to enter.
1. Syntax : placeholder = “description”
iv. Value : used to give a certain value for the so that it will
collect at server side
1. Syntax : value = “name/value”
v. Checked : will the check the selected value when the form
loaded by default.
1. Syntax : <input type = “checkbox/radio” checked>
3. The <label> tags use the for attribute to specify the ID of the input
field that the label is associated with.
4. The <select> tag uses the id, name, size, multiple, and disabled
attributes.
a. The <option> tags use the value, label, and selected attributes.
b. Syntax :
<select>
<option> dropDown value 1</option>
<option> dropDown value 2</option>
<option> dropDown value 3</option>
……
<option> dropDown value n</option>
</select>
5. The <textarea> tags use the id, name, rows, cols, placeholder, and
wrap attributes.
a. Will give a some text area to enter the data to the client.
b. There are some attributes we can use for the text area input tag
i. Rows : will create the rows to enter the data (height).
ii. Cols : will create the columns to enter the data (width).
6. The <button> tags use the type, form, value, and disabled attributes.
a. We can use the same submit and reset input types to this one
as well.
7. The <fieldset> tags use the id, name, and disabled attributes. Group
related elements together.
a. The <legend> tag uses the align attribute.
8. The <datalist> tag uses the id attribute.
a. Is similar to select tag but the only difference is it will give
suggestions instead of values.
b. Due to that we can enhance the user experience.
i. Syntax :
<input list="listName" >
<datalist id=" listName ">
<option value="value 1">
<option value="value 2">
<option value="value 3">
……
<option value="value N">
</datalist>
9. We can also use the disabled attribute to disable the input field.