Creating Lists in HTML
When we want to show information in
points (like steps, items, etc.), we use
lists.
There are three types:
© Ordered List (
)
* Unordered List ()
* Description List ()
Ordered List ()
An ordered list shows items with
numbers (1, 2, 3...).
Example:
Html ©) Copy code
- Wake up
- Brush teeth
- Go to school
Output:- Go to school
Output:
1. Wake up
2. Brush teeth
3. Go to school
Unordered List (
)
An unordered list shows items with
bullets (e).
Example:
Html ©) Copy code
Output:
e Milk
e Bread
e ButterList Properties
CSS helps us style our lists:
© Type of bullets or numbers
* Use images as bullets
© Where to place the bullets
List-Style-Type with Syntax
Changes the bullet/number style.
Example:
Html () Copy code
Here, bullets will be small squares
instead of dots.
Other types: circle, disc, decimal,
lower -alpha, etc.List-Style-Image with Syntax
Use an image instead of normal bullets!
Example:
Html ©) Copy code
Here, each bullet will be a small star
image.
List-Style-Position with
Syntax
Where do we want the bullet? Inside or
outside the text box?
Example:
Html © Copy code
eis cica® Bainter.Where do we want the bullet? Inside or
outside the text box?
Example:
Html () Copy code
- First Point
<1i>Second Point
* Inside: Bullet comes inside the text
block.
* Outside: Bullet is outside and text
starts after it.
List-Style Syntax
We can write all list styles together:
Example:
Html () Copy code
We can write all list styles together:
Example:
Html () Copy code
This uses a square bullet placed inside
the text area.
Nested Lists
A list inside another list.
Example:
Html () Copy code
- Vegetables1i>
Fruits
Vegetables
* Fruits has a sub-list for Apple and
Mango.
Description List ()
Use when you want to explain terms, like
a mini dictionary.
Example:
Html ©) Copy code
- HTML
- HyperText Markup Language
- CSS
- Cascading Style Sheets
* - is the Term
*
- is its DefinitionCreating Tables in HTML
Tables organize data into rows and
columns.
Example:
Html () Copy code
This makes a table with headers Name
and Age.
Table Properties
Some important properties:
* border: Gives a boundary line.
* cellpadding: Space inside a cell.
* cellspacing: Space between cells.— SELLpaGUlns. VPaVe HiSiue 2 Vel.
* cellspacing: Space between cells.
© width and height: Table size.
* align: How content is aligned.
Border Collapse
If you don’t want double borders
between cells:
Example:
Css ©) Copy code
table {
border-collapse: collapse;
t
This merges borders into a single line.
Horizontal and Vertical
Alignment
Center text horizontally:
Htmi (©) Copy codeEEA OLE Me Nren ee:
Example:
Css () Copy code
table {
border-collapse: collapse;
}
This merges borders into a single line.
Horizontal and Vertical
Alignment
Center text horizontally:
Html ©) Copy code
Hello |
Center text vertically:
Html ©) Copy code
World | Hover on Table Rows or Cells
Make table rows change color when you
move the mouse over them.
Example:
Css ©) Copy code
tr:hover {
background-color: lightblue;
}
Table Layout
Control the table width distribution.
Example:
Css ©) Copy code
table {
table-layout: fixed;
by
¢ Fixed: Column widths stay fixed even
if content is big.
e Auto: Column size chanaes based onif content is big.
* Auto: Column size changes based on
content.
Caption Size
Change table caption size using CSS.
Example:
Html ©) Copy code
Student Report
Height and Width
Set specific height and width for table
and cells.
Example:
Html ©) Copy code
Example:
Html ©) Copy code