Testimonials-slider. Spaghetti code and all sorts of disaster
Design comparison
Solution retrospective
Hello Mentors,
It seems like I really straggle with positioning elements. My code is full of hard-coded sizes, widths and heights. Mostly units are px's and %'s . Moreover all the numbers aren't even whole numbers e.g "margin-left: 214.756 px" , "padding-top: -49.589%" etc....
At the end it's close to the .sketch designs at required screen sizes, but somewhere between.... it's a complete disaster. Nothing is fluid or responsive.
Trying to use min, max widths but it makes the matter even worse.
Please advise! Help needed
Community feedback
- @ApplePieGiraffePosted about 4 years ago
Hey, Artem Ponomarenko! π
Good work! π Your solution looks good!
In addition to the great feedback from rfilenko, I suggest,
- Setting
min-width: 100vh
on thebody
so that it's always at least as tall as the viewport (and the SVG background image will then always be at the bottom of the screen). - You can also use
overflow-x: hidden
to get rid of the horizontal scroll bar on smaller desktop screens. - Adding a small hover state to the buttons might be a nice touch!
Keep coding (and happy coding, too)! π
2 - Setting
- @rfilenkoPosted about 4 years ago
Hi Artem, you did a great job, mobile looks ok, just a few edits will help with issues you encoutered. You're right about hard-coded values and funky ones like padding-top: -49.589%" - try to avoid them, so my suggestions:
- first, set box-sizing: border-box for all elements with * selector;
- don't use fixed values, on containers, for example set max-width, like 1200px;
- for images it's ok to set width and height, additionally object-fit will help to preserve proper picture proportions.
Usually, it's better to start with mobile-first approach and then add needed changes with wider viewport width.
Hope this was helpfulπ. Good luck with edits.
Cheers, Roman
2@ArtemPonomarenkoPosted about 4 years ago@rfilenko
It does help, thanks! Do you know any good reads or some articles maybe about this?
0@ArtemPonomarenkoPosted about 4 years ago@rfilenko
OMG ! This "box-sizing: border-box" is a game changer!!!! Thanks a lot!
1@rfilenkoPosted about 4 years ago@ArtemPonomarenko nice, basically it really depends on a subject. MDN, css tricks, other webs dedicated to frontend have a lot of articles about different topics.
0
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