Once you have learned HTML, the next step in web development is mastering CSS. CSS (Cascading Style Sheets) controls how your web pages look, including colors, spacing, layout, and fonts.
🎨 What is CSS?
CSS stands for Cascading Style Sheets. It works hand-in-hand with HTML to define how elements appear on the page, like font size, background color, margins, and more.
Here is the basic syntax:
selector {
property: value;
}
📋 25 Basic CSS Properties You Should Know
color – Text colorcolor: #333;
background-color – Background colorbackground-color: #f0f0f0;
font-size – Size of the textfont-size: 18px;
font-family – Font stylefont-family: Arial, sans-serif;
font-weight – Boldness of the textfont-weight: bold;
text-align – Align texttext-align: center;
margin – Outer spacing around elementsmargin: 20px;
padding – Inner spacing around elementspadding: 10px;
border – Border around elementsborder: 1px solid #ccc;
width – Width of an elementwidth: 300px;
height – Height of an elementheight: 200px;
display – Box layout (block, inline, flex)display: flex;
flex – Flex layout controlflex: 1;
justify-content – Align flex items with equal space between themjustify-content: space-between;
align-items – Vertical alignmentalign-items: center;
position – Static, relative, absolute, fixedposition: absolute;
top / right / bottom / left – Offset for positioned elements
overflow – Control content overflowoverflow: auto;
z-index – Stack orderz-index: 10;
opacity – Transparency levelopacity: 0.5;
cursor – Mouse cursor stylecursor: pointer;
box-shadow – Add shadow around elementsbox-shadow: 0 4px 6px rgba(0,0,0,0.1);
text-decoration – Underline, none, etc.text-decoration: none;
transition – Smooth animationtransition: all 0.3s ease;
hover – Style on mouse hover (pseudo-class)a:hover { color: red; }
Example: Styling a Button
button {
background-color: #007BFF;
color: white;
padding: 12px 20px;
border: none;
border-radius: 6px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #0056b3;
}
How to Practice CSS
Use these free tools to test your CSS code live and observe how each property give the output:
Final Thoughts
These 25 CSS properties will give you a solid foundation in front-end design. As you become more comfortable, you will start combining them creatively to build responsive and beautiful web pages.
💬 Got questions or want more beginner tutorials? Drop a comment below or explore more on this blog.