Notes About Tech
Notes About Tech
1. Structure Tags
📌 4. Lists
📌 5. Tables
📌 7. Semantic Tags
Tag Use
<header> Top of the page
<nav> Navigation section
<main> Main page content
<section> A section of content
<article> A blog post/article
<aside> Side info (ads, notes)
<footer> Bottom of the page
<figure> Wrap images & captions
<figcaption> Caption for figure
<details> Expandable content
<summary> Visible summary/title
<time> Time & date markup
<progress> Progress bar
<meter> Measurement within a range
CSS is used to style HTML elements, and it can be written in three ways:
📌 2. CSS Selectors
Selectors define which HTML elements the styles should apply to.
The CSS Box Model defines how the elements are structured and spaced in a webpage.
div {
width: 200px;
padding: 20px;
border: 5px solid black;
margin: 30px;
}
📌 4. CSS Colors
1. Color names:
2. p { color: red; }
3. Hexadecimal colors:
4. h1 { color: #ff0000; } /* Red */
5. RGB colors:
6. h2 { color: rgb(255, 0, 0); } /* Red */
7. RGBA colors (with transparency):
8. h3 { color: rgba(255, 0, 0, 0.5); } /* Semi-transparent red */
9. HSL colors:
10. p { color: hsl(0, 100%, 50%); } /* Red */
11. HSLA colors (with transparency):
12. div { color: hsla(0, 100%, 50%, 0.5); } /* Semi-transparent red */
📌 7. CSS Backgrounds
📌 9. CSS Positioning
A more advanced layout technique that allows creating complex two-dimensional layouts.
📌 1. Introduction to CSS
CSS allows you to control the layout and appearance of your website elements. You can add CSS in three
ways:
Selectors allow you to target HTML elements and apply styles. Below are various advanced selectors
with examples:
2.1 Universal Selector (*)
*{
color: black; /* All text will be black */
}
h1 {
font-size: 2em;
}
.card {
background-color: lightblue;
}
#header {
font-weight: bold;
}
input[type="text"] {
border: 2px solid blue;
}
div p {
color: green;
}
2.7 Child Selector (>)
div > p {
color: blue;
}
h1 + p {
margin-top: 20px;
}
h1 ~ p {
color: red;
}
The CSS Box Model is used to describe the rectangular boxes that are generated for elements.
Example:
div {
width: 200px;
padding: 15px;
border: 2px solid black;
margin: 20px;
}
3.1 Box-Sizing
The box-sizing property determines how the total width and height are calculated. There are two main
values:
content-box: Default behavior, padding and border are added outside the element's width and
height.
border-box: Padding and border are included in the width and height.
*{
box-sizing: border-box;
}
p { color: red; }
h1 { text-transform: uppercase; }
h1 { letter-spacing: 2px; }
a { text-decoration: underline; }
p { line-height: 1.5; }
p { font-variant: small-caps; }
.container {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.container {
display: grid;
grid-template-columns: 1fr 2fr;
grid-gap: 20px;
}
📌 7. Positioning (Advanced)
.position-absolute {
position: absolute;
top: 10px;
left: 20px;
}
.position-fixed {
position: fixed;
top: 0;
left: 0;
}
.position-sticky {
position: sticky;
top: 0;
}
Transitions allow for smooth changes of properties over a defined time period.
.button {
transition: background-color 0.3s ease;
}
.button:hover {
background-color: blue;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.fade {
animation: fadeIn 2s ease-in;
}
img {
filter: blur(5px);
}
div {
filter: grayscale(50%);
}
h1 {
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
Use media queries to apply different styles based on device characteristics like screen width, resolution,
etc.
div {
width: 50vw; /* 50% of the viewport width */
height: 50vh; /* 50% of the viewport height */
}