Theory + Code Examples 🎨
CSS (Cascading Style Sheets) is used to style HTML elements like colors, layout, and fonts.
p {
color: red;
}
/* element */
p { color: blue; }
/* class */
.box { background: yellow; }
/* id */
#title { font-size: 30px; }
body {
background: #111;
color: rgb(255,255,255);
font-size: 16px;
}
div {
margin: 10px;
padding: 20px;
border: 2px solid white;
}
div {
display: flex;
position: relative;
}
.container {
display: flex;
justify-content: center;
align-items: center;
}
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
body {
background: linear-gradient(to right, blue, purple);
}
.box {
transition: 0.3s;
}
.box:hover {
transform: scale(1.2);
}
@media (max-width: 600px) {
body {
background: red;
}
}
:root {
--main: blue;
}
p {
color: var(--main);
}
/* Keep code clean */
.container {
display: flex;
}