Design comparison
Solution retrospective
This was a fun project to work on positioning for me. It was a struggle, but I enjoyed being able to figure it out!
Centering the container keeps seeming to be a bit of a time killer for me, but practice makes perfect.
One question I have is that in the design previews the SVG background file shows two different shades of blue but mine was blue and white. Is there a way to change the colors in these files? I was able to change one, but couldn't change the bottom.
Community feedback
- @Dev-MV6Posted about 1 year ago
- There are several ways to center an element in CSS, find the one you prefer the most: https://www.freecodecamp.org/news/how-to-center-a-div-with-css-10-different-ways/, for this project since the card is the only main element in the page you can center it with the following style:
.card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
and also remove the
margin-top: 100px;
you have set in the.card
styles. This way the card would be centered correctly.- Regarding to the color issue, simply use the following styles to get the same colors as the original design:
body { background: hsl(225, 100%, 94%) url('./images/pattern-background-desktop.svg'); background-size: cover; background-repeat: no-repeat; } .card { background-color: #fff; } .card__plan { background-color: hsl(225, 100%, 98%); } button { background-color: hsl(245, 75%, 52%); } .card > a { color: hsl(224, 23%, 55%); }
Hope you find this helpful.
Marked as helpful1 - @JosephAbuchiPosted about 1 year ago
The easiest way to center your element: display: grid; justify-content: center; align-items: center;
1
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