Design comparison
Solution retrospective
please help me in making the code shorter
Community feedback
- @GerbenDolPosted over 4 years ago
Hey! A good way to make your code shorter is to bundle some of the styles for the 4 different cards.
There are a lot of properties that have the same value, just to list some:
- height:25%;
- width:30%;
- position: absolute;
- background-color: #FFFFFF;
- box-shadow: 1px 8px 10px lightgrey;
- border-style:none;
- border-top-style: solid;
- border-width: 3px;
- transition: .2s;
If you would combine these all under one class it would help your code massively!
You can either do that by putting all this code under de following selector: . supervisor, . teambuilder, .calculator, .karma { /* Shared styles go here */ } and after that applying the more specific styles like position and border color for each specific class.
Or you can add an extra class, for example .card, to all the items and put the common styles in there.
Hope this helps!
2
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord