Not Found
Not Found
Cannot read properties of null (reading 'code')
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Cannot read properties of null (reading 'code')
Not Found
Not Found
Not Found
Cannot read properties of null (reading 'code')
Not Found

Submitted

Single Landing Page (Mobile-first responsive approach + Flexbox)

Paras SharmaтАв 700

@imparassharma


Design comparison


SolutionDesign

Solution retrospective


I tried mobile first approach for making this webpage. I am not able to properly set the background image to only top half in the mobile width. If anyone can help me out. Also all other suggestions are welcome.

Community feedback

Shahin NJтАв 1,190

@SJ-Nosrat

Posted

Hi Paras, Great that you're using mobile first approach on your solution; that's the correct way to go! With regards to your question it's an easy fix, do the below:

body{
    margin: 5vh 10vw;
    background-color: hsl(257, 40%, 49%);
    background-image: url(images/bg-mobile.svg);
    background-position: top;
    background-size: contain;
    font-family: 'Open Sans', sans-serif;

    /* ADD THE BELOW CODE */
    background-repeat: no-repeat;
}

Also, did you notice that when viewing your solution in mobile screen sizes, your social links appear above you .main content; I think you should cut-and-paste the below code into your <div class="main"> container as you have display: flex; on it:

 <div class="social-link">
        <a href=""><aria-hidden="true" img src="images/facebook.png" alt=""></a>
        <a href=""><aria-hidden="true" img src="images/twitter.png" alt=""></a>
        <a href=""><aria-hidden="true" img src="images/instagram (1).png" alt=""></a>
</div>

Notice that I included the aria-hidden="true" attribute for you <img> tag, this helps screenreaders skip images that are purely decorative.

Lastly, instead of using <div>'s everywhere in your HTML structure, try and use semantic HTML, you can read more on it here.

For example your <div class="main"> element can be: <main class="main">.

Hope the above helps!

Best of luck on your coding journey!

Marked as helpful

1

Paras SharmaтАв 700

@imparassharma

Posted

@shahin1987 Thanks for the reply. Really helpful. Will work on the suggestion you gave.

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