Learn coding with amol
Hello my name is amol or vineet and this is my second part of learn coding with amol and in this part we are learning css.
PART-2 CSS:-
π¨ Complete CSS Guide
This guide explains important CSS properties with examples and copyable code.
1. Color and Background
Set text color and background color.
p {
color: white;
background-color: blue;
}
2. Font and Text
Control font size, family, and alignment.
h1 {
font-size: 32px;
font-family: Arial, sans-serif;
text-align: center;
}
3. Margin and Padding
Spacing outside (margin) and inside (padding) of elements.
div {
margin: 20px;
padding: 10px;
}
4. Borders and Border Radius
Add borders and rounded corners to elements.
img {
border: 2px solid black;
border-radius: 10px;
}
5. Box Model
Every element is a box: content + padding + border + margin.
.box {
width: 300px;
padding: 20px;
border: 2px solid #000;
margin: 10px;
}
6. Position
Used to place elements: static, relative, absolute, fixed.
.box {
position: absolute;
top: 50px;
left: 100px;
}
7. Flexbox
Modern layout system for building flexible UIs.
.container {
display: flex;
justify-content: center;
align-items: center;
}
8. CSS Grid
Two-dimensional layout system.
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
9. Hover Effects
Change styles when the mouse hovers.
a:hover {
color: red;
text-decoration: underline;
}
10. Responsive Design (Media Queries)
Make sites mobile-friendly.
@media screen and (max-width: 600px) {
body {
background-color: lightgray;
}
}

Comments
Post a Comment