1/149
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
div
Block-level element
Defines a section or a division in an HTML document
It is used as a container for HTML elements to give style using CSS and modify using JavaScript.
One of the fundamental building blocks in HTML used to group
and style content.
Can be used anytime
Generic elements that have no semantic meaning on their own.
They only become meaningful using CSS and JavaScript.
span
Inline element
Does not inherently force new lines or consume any more space than necessary beyond what its contained content requires.
Used to group a small chunk of HTML elements or text for styling purposes, without disrupting the surrounding content's layout
One of the fundamental building blocks in HTML used to group
and style content.
Can be used anytime
Generic elements that have no semantic meaning on their own.
They only become meaningful using CSS and JavaScript.
class
id
lang
aria roles
Styles — for inline CSS
Global Attributes of div and span:
<form>
Used to create a form for user input.
It has an opening and closing tag.
Are essential for collecting data from users, such as:
Login credentials,
Search queries; or
Feedback.
It is a container for different types of input elements, such as:
Text fields,
Checkboxes,
Radio buttons,
Submit buttons, etc.
Syntax:
<body>
<form action="" method="">
<!--
form elements
-->
</form>
</body>
action
method
Attributes of <form>
:
action
Specifies the URL where the form data should be sent when the form is submitted.
method
Defines the HTTP method to use when sending form data.
get
post
Common values of method
attribute of <form>
:
<input>
It is used to accept data input from the user.
It can be configured to accept a variety of data types by setting its type attribute to different values.
Syntax:
<form action="form1success.html">
<label>Player Name
<input id="name" type="text">
</label>
<label>Age
<input type="number" placeholder="Enter Age" required>
</label>
<button>Register</button>
</form>
type
value
name
disabled
required
readonly
<input>
attributes:
type
Specifies the type of input
<input>
element can be displayed in many ways based on the type attribute.
text
radio
checkbox
submit
button
password
range
date
file
hidden
search
url
tel
number
Different kinds of type attribute:
value
Specifies the default value of the input
name
Specifies the name of the input
disabled
Specifies that the field is disabled
required
Specifies that the field is required
readonly
Specifies that the field can only be read
File
checkbox
radio
button
reset
submit
Types of Button:
file
For selection of files from local storage
Syntax:
<form>
<input type="file" accept="image/jpeg" multiple><br><br>
<input type="submit">
</form>
checkbox
For allowing multiple selection
Syntax:
<form>
<input type="checkbox" id="creamcheese" name="addons" value="creamcheese">
<label for="creamcheese">Cream Cheese</label>
<br>
</form>
radio
For allowing one selection
Syntax:
<form>
<input type="radio" id="milktea" name="drinks" value="milktea" required>
<label for="milktea">Milktea</label>
<br>
</form>
button
Just a button
reset
For resetting all the value of the form
Syntax:
<input type="reset" value="Reset>
submit
For submitting the form
Syntax:
<input type="submit" value="Submit>
accept
multiple
Attributes for <input type="file">
:
accept
Specifies the files accepted
multiple
Specifies if multiple files are accepted (for file type)
Can select multiple items in the list (for select element)
text
password
number
tel
search
url
Types of Textfield:
text
For normal text field
Syntax:
<p>
<label for="username">Username:</label>
<input type=text" name="username" placeholder="Enter your username">
</p>
For email address validation
Syntax:
<p>
<label for="email">Email:</label>
<input type=email" name="email" placeholder="Enter your email" required>
</p>
password
For hiding text
Syntax:
<p>
<label for="password">Password:</label>
<input type=password" name="password" placeholder="Enter your password">
</p>
number
For allowing numbers
tel
For telephone number format validation
Syntax:
<p>
<label for="phone">Phone:</label>
<input type=tel" name="phone" placeholder="Enter your phone number">
</p>
search
For searching
Syntax:
<p>
<label for="search">Search:</label>
<input type=search" name="search" placeholder="Search Here">
</p>
url
For url validation
Syntax:
<p>
<label for="url">Website:</label>
<input type=url" name="website" placeholder="Enter URL">
</p>
placeholder
minlength
maxlength
size
Some of Textfield Attributes:
date
datetime-local
month
week
time
Types of Date/Time:
date
For inputting date/month/year
Format: YYYY-MM-DD (2024-04-18)
Syntax:
<p>
<label for="date">Date:</label>
<input type=date" id="date" name="date" min="2023-04-19" max="2025-12-12">
</p>
datetime-local
For inputting date/month/year and time
Format: YYYY-MM-DDThh:mm (2024-04-18T14:20)
Syntax:
<p>
<label for="datetime-">Date:</label>
<input type=date" id="date" name="date" min="2023-04-19" max="2025-12-12">
</p>
month
For inputting month and year
Format: YYYY-MM(2024-04)
Syntax:
<p>
<label for="month">Month and Year:</label>
<input type=month" id="month" name="month" min="2023-12">
</p>
<textarea>
It indicates a text area.
It is used for long text, such as:
an essay,
paragraphs, etc.,
Syntax:
<form>
<label for="bio">Biography:
<textarea id="bio" placeholder"Write about yourself" rows="5" cols"30" maxlength="500"></textarea>
</label>
</form>
rows
cols
Attributes of <textarea>
:
rows
Specifies the default number of lines in a text area.
cols
Specifies the default width of a text area.
<select>
It indicates a drop-down list of options from which users can select one or more.
Syntax:
<select id="fruits" name="fruits"></select>
<option>
Inside the <select>
element there is an element wherein it indicates an item in a drop-down list.
Syntax:
<select id="fruits" name="fruits">
<option value="orange">Orange</option>
<option value="lemon">Lemon</option>
<option value="lime">Lime</option>
</select>
<optgroup>
This element indicates an item group in a drop-down list.
Syntax:
<select id="fruits" name="fruits">
<optgroup label="Berries">
<option value="strawberry">Strawberry</option>
<option value="blueberry">Blueberry</option>
<option value="raspberry">Raspberry</option>
</optgroup<
</select>
multiple
size
name
required
disabled
Attributes of <select>
:
size
Specifies number of options visible in the drop-down
<table>
Allow web developers to arrange data into rows and columns.
The container element for the table
<tr>
Defines the table row
<th>
Defines a table header cell
Typically used for labelling columns
<td>
Defines a standard cell in the table; where data goes
<thead>
Defines a set of rows defining the head of the columns of the table
<tbody>
Encloses the main content of the table
<tfoot>
Defines a set of rows summarizing the columns of the table
colspan
rowspan
<th>
and <td>
Element Attributes:
colspan
Specifies the column span of the cell.
rowspan
Specifies the row span of the cell.
<caption>
Used to define a table caption
Website
It is a collection of files and folders containing different web resources that are linked to each other.
Website File Structure
Folders = directories
The root folder contains all the project files
Related files are grouped into subfolders (such as “css” or “images”)
File Naming Tips
Avoid spaces and symbols - separate words with an underscore or hyphen
Use all lowercase letters
Use meaningful and descriptive names for SEO and for organization
Domain name
Server
Web hosts
How to make website Online?
Domain name
It is the address used to access the website
Server
It is used to store the website files
Web hosts
It provides the server space
CSS
Abbreviated form of Cascading Style Sheets
Controls the document’s appearance and separates the presentation from the content
It is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents
It is made of rules, and rules are made of selectors and declaration blocks.
Inline Style Sheet
Embedded Style Sheet
External Style Sheet
Types of CSS Styles:
Inline Style Sheet
It places CSS rules after the attribute and before closing the bracket.
This is referred to as the inline rule and affects only the tag where it is included.
They are not reusable, and they override style rules added by other methods.
Multiple styles must be added to the same style attribute which can make it difficult to read and manage.
Syntax:
<p style="color: red; font-size: 14px;">Hello World!</p>
Embedded/Internal Style Sheet
Placed at the head of the HTML document, this is useful for single web pages, such as blogs, or using the same web page templates on several web pages.
It is added to the <head>
section of the HTML document.
All the CSS style rules are enclosed between <style>
tags.
CSS selectors can then be used to apply styles to all the matched element.
To style multiple pages, the same block must be added to
each page.
Syntax:
<head>
<style>
p{
color: red;
}
</style>
</head>
External Style Sheet
This involves using a separate file for the CSS
It is referenced in the HTML file using the <link>
tag.
It is included in the <head>
section of the document.
Reusable and easier to maintain.
Syntax:
<head>
<link rel="stylesheet" href="css/ExternalCSS.css">
</head>
Declaration Block
Selector
Declaration
Property
Value
Syntax and Rules:
Declaration Block
Contains one or more style rules enclosed in curly brackets.
Selector
Specifies which HTML element to apply the style to.
Selectors are ways to select the HTML tags where styles apply.
Declaration
CSS style rules and use property value pairs to provide instructions to the browser on how to style a specific HTML element.
Property
Specifies what is being styled like background.
Are separated with a colon and end with a semicolon to indicate the end of the rule.
Value
Defines the specific characteristics
Are separated with a colon and end with a semicolon to indicate the end of the rule.
Shorthand Properties
Defined with multiple values
Syntax:
padding: 10px 5px 20px 15px;
Longhand Properties
Defined with individual values
Syntax:
padding-top: 10px;
padding-right: 5px;
padding-bottom: 20px;
padding-left: 15px;
Comments
Starts with a slash and asterisks and ends in the opposite order
Syntax:
/* This is a comment */
/*
This is a
multiline
comment
*/
/* -----------------------
This comment has hypens!
----------------------- */
Whitespace
Required syntax for certain uses (such as separating CSS Values)
Used to format the code for readability but is not required.
Whitespace like:
spaces,
tabs; and
line breaks
Color Property
It changes an element’s text color and text decoration (such as underline or strikethrough)
It is defined with different types of <color>
values.
It is used with different color values.
Keyword Values
RGB Function Values
RGB Hexadecimal Values
Color Property can be defined using Color Values:
Keyword Values
Predefined keywords
Syntax:
color: red;
color: blue;
color: green;
color: black;
RGB Function Values
0 is Black
255 is White
Literally rgb([red] [green] [blue])
Syntax:
color: rgb(0,0,0); /* Black */
color: rgb(255,255,255); /* White */
color: rgb(255,0,0); /* Red */
color: rgb(0,255,0); /* Green */
color: rgb(0,0,255); /* Blue */
RGB Hexadecimal Values
Hex codes of colors
Like #rrggbb or #RRGGBB
Syntax:
color: #000000; /* Black */
color: #ffffff; /* White */
color: #ff0000; /* Red */
color: #008000; /* Green */
color: #0000ff; /* Blue */
Type Selector
Universal Selector
Class Selector
ID Selector
Different kinds of CSS Selectors:
Type Selector
Used as a selector to set the associated tag.
Also referred to as element selectors
Syntax:
/* This style will apply to all <h2> elements */
h2{
color: darkslategray;
}
Universal Selector
Select all elements on the HTML page using an asterisk (*)
May cause performance issues and should be used sparingly
Syntax:
/* This style will apply to ALL elements */
*{
border: 1px solid black;
}
Class Selector
Match to one or more elements
Add a class attribute to the HTML element.
Syntax:
<!-- HTML -->
<p class="fancy">Fancy Paragraph</p>
/* CSS */
.fancy{
font-style: italic;
}
ID Selector
Match to a single unique element
Add a ID attribute to the HTML element.
Syntax:
<!-- HTML -->
<header id="custom-name"></header>
/* CSS */
#custom-name{
background: lightblue;
}
DOM
Abbreviated of the word Documented Object Model
Represent the relationship between HTML elements.
Descendant Combinator
Used to select nested elements by combining two selectors.
One targeting an ancestor element and the other a descendant element.
It must be separated with a space
Syntax:
section p{
color: green;
}
Selector List
Can be grouped to apply shared styles to more than one selector at once.
Syntax:
h1, h2, h3{
font-weight: normal;
}
background-color
This property is useful for adding colors to the backgrounds of web pages, tables, or other elements that hold HTML content.
Values can be HTML color codes or color names.
Syntax:
background-color: #ffffff;
background-color: yellow;
background-image
Property that uses images as backgrounds
Syntax:
background-image: url('sample1.jpg');
background-position
To set images, you can add further position declaration
You can also use different length units
Syntax:
background-position: top left;
background-position: top right;
background-position: top center;
background-position: center left;
background-position: center right;
background-position: bottom left;
background-position: bottom right;
background-position: bottom center;
background-repeat
If the image file is smaller than the area it’s applied to, the image will repeat horizontally and vertically to fit the entire area.
Syntax:
background-repeat: no repeat;
letter-spacing
Spacing between letters
Add numerical value by points (pt), pixels (px), and em
Syntax:
letter-spacing: 10pt;
letter-spacing: 10px;
letter-spacing: 1em;