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

Clipboard landing page almost pixel perfect :)))

@MajorFreedom

Desktop design screenshot for the Clipboard landing page coding challenge

This is a solution for...

  • HTML
  • CSS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

This is my first landing page that I created uing html and css. There was tries before, but they was clunky and wasn't responsive at all.

What challenges did you encounter, and how did you overcome them?

My biggest problem now is how use ems and rems and % correctly and also choosing good margins between elements.

What specific areas of your project would you like help with?

What the best ways to use relative units like em and rem, I know that its useful when you build responsive layouts (always useful then). But I cant tell what size would be element at the start. Maybe you should declare font-size in the body element (For example 16px) or its good to write 1rem?

Community feedback

@krushnasinnarkar

Posted

Hi @goziecode,

Congratulations on successfully completing the challenge! Your solution looks nice.

Here's a detailed guide on how to use em and rem:

Understanding em and rem

  1. em:

    • Relative to the font-size of the parent element.
    • Useful for scaling an element in relation to its parent.
  2. rem:

    • Relative to the font-size of the root element (<html>).
    • Provides a consistent scaling factor across the entire document.

Best Practices

  1. Set Base Font Size:

    • It is common to set the base font size on the <html> or <body> element.
    • Example:
      html {
        font-size: 16px; /* This means 1rem = 16px */
      }
      
    • This helps in maintaining a consistent scaling factor. For instance, if you declare html { font-size: 16px; }, then 1rem equals 16px.
  2. Use rem for Global Sizing:

    • For elements that need to maintain a consistent size relative to the root, use rem.
    • Example:
      h1 {
        font-size: 2rem; /* 32px if base font-size is 16px */
      }
      p {
        font-size: 1rem; /* 16px */
      }
      
  3. Use em for Component-Level Sizing:

    • For elements that need to scale relative to their parent, use em.
    • Example:
      .container {
        font-size: 1rem; /* 16px */
      }
      .container .title {
        font-size: 1.5em; /* 24px (1.5 * 16px) */
      }
      
  4. Combine rem and em for Flexibility:

    • Use rem for general layout sizing and em within components to ensure flexibility.
    • Example:
      body {
        font-size: 16px;
      }
      .card {
        padding: 1.5rem; /* 24px */
        border-radius: 0.5rem; /* 8px */
      }
      .card .title {
        font-size: 2em; /* 32px if .card's font-size is 16px */
      }
      
  5. Use CSS Variables for Flexibility:

    • Define font sizes as CSS variables for easy adjustments.
    • Example:
      :root {
        --base-font-size: 16px;
        --heading-font-size: 2rem; /* 32px */
      }
      body {
        font-size: var(--base-font-size);
      }
      h1 {
        font-size: var(--heading-font-size);
      }
      

Calculating Sizes

  1. Starting with px for Reference:
    • Sometimes, it’s easier to start with px values for initial designs and then convert to rem or em.
    • Use a conversion tool or simple math: desired size / base size = rem value.
    • Example: For a 24px element, if the base size is 16px, 24 / 16 = 1.5rem.

Practical Tips

  1. Responsive Design:

    • Using rem ensures that changes to the root font size (e.g., via media queries) cascade consistently across the layout.
    • Example:
      @media (max-width: 768px) {
        html {
          font-size: 14px; /* Adjust base size for smaller screens */
        }
      }
      
  2. Accessibility:

    • Users can adjust the base font size in their browser settings, and using rem ensures your layout respects these preferences.

Conclusion

By setting a base font size and using rem and em appropriately, you can create responsive and flexible designs. Start by declaring a base font size in the root or body, then use rem for consistent global sizing and em for component-level scaling. This approach ensures your layouts are both responsive and accessible.

Your solution looks nice, though there is a thing you can improve which I hope will be helpful:

  • Between 1024px and 1200px screen sizes, the .advantages section gets shrunk due to the computer image. You may need to work on it by adjusting widths or margins.

I hope you find this helpful, and I would greatly appreciate it if you could mark my comment as helpful if it was.

Feel free to reach out if you have more questions or need further assistance.

Happy coding!

Marked as helpful

0

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