@manishsinghraj
Posted
Its up to your preference to decide the ordering.
Personally I prefer to follow the hierarchy of the HTML structure when arranging CSS properties. I begin by organizing elements based on their position in the HTML hierarchy.
for individual properties I typically start with layout adjustments, like padding and margin, and then styling properties. I group related properties together for easier reference.
For example:
.container {
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
margin: 10px;
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 5px;
font-family: Arial, sans-serif;
font-size: 16px;
}
Marked as helpful
@corkang
Posted
@manishsinghraj Thanks for the comment 🙂!!! Layout first and then styling sounds reasonable. I'll try it in my next project.