Design comparison
Solution retrospective
Had some issues with the button sizing and positioning, would love some feedback and advice
Community feedback
- @kens-visualsPosted about 3 years ago
Hey @RyXkci 👋🏻
I have some feedback on how to fix the accessibility and HTML issues. Also, I'll help you to fix the button.
- First things first, all your
img
tags have to have analt=""
in this case it can be the name of the image such asalt="sedan"
. Yet in this case you should also addaria-hidden="true"
, because those icons are for decoration. You can read more aboutaria-hidden
here. When you fix them, don't forget to generate a new report. - Next, I'd suggest using
class
overid
. Becauseid
always has to be unique and is not reusable, however,class
isn't. - To fix the HTML issues, I suggest replacing
<section>
with<div>
, for a couple of reasons. First,<section>
is generally used for bigger things, such as a comment section, image gallery, etc. Second, if you're using<section>
you have to have some type of headingh1-h6
, but in this case you're wrapping it over<buttin>
, so it's not possible to have a heading. You can read more about<section>
here. - Let's start styling the button. You should change the padding to something like this
padding: 15px 40px;
. Try to usepixels
orrem
for padding, margin, font-size, and useperentage
forwidth
andheight
. Next, instead ofborder: none;
change this toborder: 1px solid transperent;
. After that, change thewidth
of.cards
to85%
. And finally, addpadding: 20px
to.card
. Those changes will make them to look as close to the design as possible.
I hope this was helpful 👨🏻💻 you did a good job with the layout, it was just those minor changes to make it look even better. Cheers 👾
Marked as helpful1@RyXkciPosted about 3 years ago@kens-visuals Hey, thanks so much for all the help!
You are correct about the id. I only styled one card, then I copied the html lines down and they all fell in to place..only I forgot that I temporarily set an id for the image, thanks for pointing that out! That's interesting about the image attribute, I thought that for icons and decorations it was best practice to ignore it, and I'll definitely read about the section and div! Soon, I'll attempt to do the stylings you pointed out!
Thanks again! And what do you think of the nested Flexboxes? Good or bad idea? It makes it so much easier.
0@kens-visualsPosted about 3 years ago@RyXkci you're welcome ✌🏻
There's nothing wrong with the nested Flexboxes, it's actually a common practice to do so, and yes it's a lot easier than back in the days when layout was made with
float
s 🤦🏻♂️Marked as helpful1 - First things first, all your
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