Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Built using Grid, Flexbox, SCSS and media queries

@shizukaayane

Desktop design screenshot for the Sunnyside agency landing page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


I did the paddings for the text grid items manually with media queries. How should I do it differently to have the padding automatically adjust? When I did it with percentages, it didn't work.

Other struggle I had was the header background image. I made it with CSS background-image, but I didn't know how to make the element width and height of the background so the whole background would be visible. I reckon it can't be done, or am I missing something? (I found a workaround to this problem with padding-top and aspect ratio in percent value).

Community feedback

Rafal 1,395

@grizhlieCodes

Posted

  1. Interesting question with the paddings. Whilst I prefer using media queries in most cases I have dabbled in using padding: clamp(min, preferred, max) in a few projects.

I think clamp is still underutilised by most people. It basically allows you to set a minimum value, a preferred value (this is where the magic happens) and a max-value.

The preferred value is usually a mixture of rem + vw. The vw will of course be different as the screen gets smaller/bigger hence it is our responsive value.

I have 2 resources for you:

  1. Video by Kevin Powell, skip to the clamp bit. Most videos push about clamp being for fonts only (or specifically), not true. It can be used for lots of things, especially where width is concerned.

  2. Once you've watched the video and played around with clamp, perhaps in codepen, use this tool to get the EXACT clamp values you need.

  3. As for the background-image question: Background image isn't the worst idea. But you could opt for containing the image within HTML instead and using object-fit and object-position instead. Background image is useful when the heights/widths are predefined (I think). So opting for a HTML solution might be beneficial in this case. Here is a small demo I built.

Then you can position this absolutely perhaps to the main 'top' container or something along those lines?

  1. I think even this design should have a max-width, perhaps the standard 1440px or even smaller. I have a 49" display and whilst testing how the image stretches may seem fine, it is pointless. The user should not look so much in between left and right to see the text/images below.

  2. I think your HTML structure can be a bit improved. Something like this:

<header>
</header>

<main>

     <section class="hero">
</section>

     <section class="calls-to-action">
</section>

     <section class="services">
</section>

     <section class="testimonials">
</section>

</main>

<footer>
</footer>

Hope this was somewhat helpful!

Marked as helpful

1

@shizukaayane

Posted

@grizhlieCodes Thanks so much for your response. (Sorry it took me so long to respond 😌)

Your response is really helpful. The clamp() would be a great solution, maybe I'll try it in other project.

For the background image I thought about doing it with the standard img element but this seemed to be the perfect time to use the css background image (also because I haven't used it quite as much and wanted to try it out).

As for the max-width, I completely forgot that other people can have wider monitors 😅. And also with the background image it wouldn't look that good with single color background maybe, but that's just how it goes with wide monitors I suppose.

I'll try to improve on my HTML structuring skills going forward. 💖

1
Rafal 1,395

@grizhlieCodes

Posted

@shizukaayane I know exactly what you mean with the whole background image/single color issue.

Truth be told that is a problem with the design, not any code we might want to apply. Designers should think of these things way ahead of time and I suppose most of the time they don't need to due to the rather simple nature of most websites.

Some more crafty ones solve these challenges in interesting ways though, although I can't think of a great example at the moment...

Hope you enjoy clamp once you get used to it, it's an awesome tool at our disposal😁

0
bunee 2,060

@buneeIsSlo

Posted

Hey! @shizukaayane, The site looks great! I really like how you've modified the scroll bar. Well done!

To answer your first question... You can use the em unit for the padding instead of rem , This will adjust the padding relative to the font size. Here's an article which is quite useful.

To answer the second, That's totally fine. As long as it works.

Also the link to your github repo is incorrect, So you might want to fix that. Hope this helps. Also that's a cool profile pic :D

1

@shizukaayane

Posted

@buneeIsSlo Thanks for your reply! Sorry I respond this late.

Oh, I've could have used the em units, that's a great idea. My mind was so used rem units (because I use it on almost everything) that I forgot there are other units as well 😀. Maybe I could've just used flex and align it to center also.

Yeah, this has been the first encounter of this "hacky" use of background image for me.

I fixed the repo visibility. Thanks for reminding me. I didn't want to create individual repository for every FEM challenge so I just created one and created folders for challenges.

1

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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