Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 2 years ago

Responsive Landing Page using the basics of CSS and HTML

Dor Shani•150
@dors001
A solution to the Workit landing page challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I had to play around a lot with the images relative positioning which made for some clunky areas. There is 1 thing that i'm not sure of:

  • after the rounded bottom of the hero section there is a change in background tone. I had to set the div after the hero section to relative and push the element up in order to cover the white canvas that was left after rounding the bottom edge.

here is my HTML:

<header class="block block--primary nav--block"> <div class="nav"> <div class="icon--container"> <a href="#"><img src="assets/images/logo-light.svg" alt="Workit Logo"></a> </div> <button class="btn btn--secondary">Apply for access</button> </div> </header> <div class="block--primary block__rounded block-hero"> <div class="hero"> <div class="hero__bg-pattern-1"> <img src="assets/images/bg-pattern-1.svg" alt=""> </div> <h1 class="hero__heading">Data <u class="underline__color-accent">tailored</u> to </br>your needs.</h1> <button class="btn btn--primary hero__btn">Learn more</button> <div class="hero__bg-pattern-2"> <img src="assets/images/bg-pattern-2.svg" alt=""> </div> </div> </div> <div class="container-hero__image"> <img src="assets/images/image-hero.webp" class="hero__image" alt="Hero Image" /> </div> <section class="grid grid-feature block--secondary block__rounded"> <article class="block-feature"> <div class="feature"> <div class="feature__icon-container"> <span>1</span> </div> <h3 class="feature__heading">Actionable Insights</h3> <p class="feature__content"> Optimize your products, improve customer satisfaction and stay ahead of the competition with our product data analytics. </p> </div> </article> <article class="block-feature"> <div class="feature"> <div class="feature__icon-container"> <span>2</span> </div> <h3 class="feature__heading">Data-driven decisions</h3> <p class="feature__content"> Make data-driven decisions with our product data analytics. Our AI-generated reports help you unlock insights hidden in your product data. </p> </div> </article> <article class="block-feature"> <div class="feature"> <div class="feature__icon-container"> <span>3</span> </div> <h3 class="feature__heading">Always affordable</h3> <p class="feature__content"> Always affordable pricing that scales with your business. Get top-quality product data analytics services without hidden costs or unexpected fees. </p> </div> </article> </section>

Here is my CSS: /* Hero */ .block-hero { position: relative; height: 363px; overflow: hidden; }

.hero { padding: 0 1.6rem; }

.hero__heading { margin: 0 auto; margin-bottom: 4rem; color: white; text-align: center; }

.hero__btn { display: block; margin: 0 auto; width: 13rem; height: 5.5rem;
}

.container-hero__image { background-color: var(--color-secondary); height: 100px; }

.hero__image { position: relative; max-width: 320px; margin: 0 auto; left: 3.6rem; top: -10rem; overflow: visible; }

.hero__bg-pattern-1, .hero__bg-pattern-2 { position: absolute; left: -50rem; }

@media screen and (min-width: 768px) { .block-hero { height: 421px; }

.hero__image { max-width: 515px; left: 15.1rem; top: -15rem; }

.hero__bg-pattern-1 { left: -23rem; top: -6rem; }

.hero__bg-pattern-2 { bottom: 10rem; left: 68rem; } }

@media screen and (min-width: 1024px) { .block-hero { height: 405px; }

.container-hero__image { height: 320px; }

.hero__image { max-width: 770px; top: -10rem }

.hero__bg-pattern-2 { left: 90rem; } }

@media screen and (min-width: 1440px) { .block-hero { height: 510px; }

.hero__image { max-width: 770px; left: 35rem; top: -20rem }

.hero__bg-pattern-1 { left: -13rem; top: -2rem; }

.hero__bg-pattern-2 { left: 131rem; } }

@media screen and (min-width: 1880px) { .hero__image { max-width: 770px; left: 60rem; top: -20rem }

.hero__bg-pattern-2 { left: 175rem; } }

/* Features */

.grid-feature { position: relative; margin: 0; z-index: -1; top: -15rem; padding: 15rem 0; }

.block-feature { margin: 0 auto; text-align: center; }

.feature__icon-container { border-radius: 50%; border: 1px solid #584D62; font-family: 'Fraunces', Arial, Helvetica, sans-serif; width: 4.8rem; height: 4.6rem; margin: 2.4rem auto;
}

.feature__icon-container>span { display: block; margin-top: 0.5rem; }

.feature__icon, .feature__heading { color: var(--color-primary); }

.feature__heading { margin: 1.6rem auto; }

.feature__content { max-width: 343px; margin: 0 auto; }

@media screen and (min-width: 768px) { .grid-feature.block--secondary { height: 1500px; align-items: start; padding: 25rem 0; }

.block-feature { text-align: left; max-height: 108px; }

.feature__icon-container { position: relative; text-align: center; margin: 0; top: 11rem; }

.feature__heading, .feature__content { max-width: 493px; margin: 1.6rem 0; margin-left: 8rem; } }

@media screen and (min-width: 1024px) { .block-feature { text-align: center; max-height: fit-content; }

.grid-feature { position: relative; grid-auto-flow: column; top: -40rem; justify-content: center; align-content: end; gap: 3rem; max-height: 1100px; }

.feature__icon-container { position: static; margin: 2.4rem auto; }

.feature__heading, .feature__content { max-width: 354px; }

.feature__heading { margin: 1.6rem auto; }

.feature__content { margin: 0 auto; } }

@media screen and (min-width: 1440px) { .grid-feature { padding: 0 10rem; } }

/* Feature Block */

.feature { margin: 4rem auto;
}

Feedback Welcome! Thank you everyone.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Prince Awuah Karikari•170
    @PRINCEKK122
    Posted almost 2 years ago

    Congratulations on knocking off your first challenge here.

    As a quick note, we can view your code by pressing the View code button, so next time, I suggest you use this section to draw reviewers attention to some parts of your code.

    Marked as helpful
  • Tushar Biswas•4,060
    @itush
    Posted almost 2 years ago

    Congratulations on completing the challenge! 🎉

    Welcome to the platform! 🎉 We're thrilled to have you here and excited to see your progress 💪as you continue your front-end development journey.

    Your solution looks nice to me :)

    • Yes, it is important to correctly understand CSS Position property to render HTML elements as per the requirement. Please note:

    • By default, all HTML elements are static (non-positioned elements).

    • By using top, right, bottom, left we can control the final location of an HTML element.

    • Top, right, bottom, left, z-index don’t have any effect on Statically positioned / non-positioned elements.

    • So, basically, we first need to convert a non-positioned element to a positioned element using (relative/fixed/absolute/sticky) then only (top/right/bottom/left/z-index) etc. will work for the targeted element.

    • To reset the default browser styles you may also add padding: 0; box-sizing: border-box;

    In my projects:

    • I always start with mobile-first workflow.
    • I use at least one main element for a page (entire content goes into the main, if I'm not using header & footer), and avoid divs as much as possible and use section and article element wherever I can.
    <body>
    <main>
    All content 
    </main>
    </body>
    
    • I Use relative units as much as possible and avoid absolute units whenever possible.
    • If you are someone who is just starting out with front-end development, I strongly suggest starting with the QR code component project. Also in the challenges page you may filter by (Newbie, HTML&CSS) sort by (easier first) to select projects that will help you solidify your foundation. To avoid any knowledge gap please first solidify HTML, CSS, JS fundamentals and then move on to any framework or library.
    • I remember when I started out, I made countless mistakes and spent long hours searching for solutions. But hey, you don't need to go through the same struggles! 🙌 To help you shorten the learning curve, I recommend going through the following articles. They contain valuable insights that can make your journey smoother:

    📚🔍 12 important CSS topics where I discuss about css position, z-index, box-model, flexbox, grid, media queries, mobile-first workflow, best practices etc. in a simple way.

    📚🔍 11 important HTML topics where I discuss about my thought process and approach to convert a design/mock-up to HTML along with other topics.

    I hope you find these resources helpful in your coding adventures! 🤞

    I'm eagerly looking forward to seeing the amazing projects you'll create in the future! 🚀💻

    Keep up the fantastic work and happy hacking! 💪✨

    We'll definitely look into your github repo, no need to post the code here😁

    Marked as helpful

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit 1st-party linked stylesheets, and styles within <style> tags.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub