Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Hi guys having issues with media queries not working i want to give a <p> a margin of 3% on larger screen sizes ..

Hi guys having issues with media queries not working i want to give a <p> a margin of 3% on larger screen sizes .... tried everything been stuck for 4/5 days @media all and (min-width: 800px) {

.paragraph3 { margin-top: 8%;

}

}

i have used the correct class to select <p>

3 Answers

Steven Parker
Steven Parker
243,656 Points

That code works except that it sets the margin to 8% but you said you wanted 3%. Perhaps the issue is in the HTML, which isn't shown here. Are you sure the class is applied properly to the paragraphs?

If you're still having trouble, be sure to show the complete code (HTML/CSS). Or use the workspace and make a snapshot of your workspace and post the link to it here.

Thank you for your reply Steven! the code is below

```<div class="container"> <!-- About section container --> <div class="row about-div section-border"> <div class="col-md-6"> <p class="paragraph3"> Hi there! My name is Andrew O’Reilly and this is my website. I am 23 years old and originally from Dublin, Ireland. My passion for coding started in Christmas of 2016 and grew from there. One of my favorite things about programming is that it is a constant learning journey. There are endless possibilities of languages, frameworks, libraries etc to learn. My worst fear is being stuck in a job doing the same thing day in day out and not growing in any way. Programming gives me the ability to be constantly learning and growing each day. </p> </div>

<div class="col-md-6"> <img src="https://i.imgur.com/hFMXFFI.jpg" alt="me" class="mx-auto d-block img-fluid rounded-circle img-me"> </div> <div class="row three-col"> <div class="col-md-6"> <p>I have really enjoyed the challenges that computer programming has given me. Sometimes quitting does seem like the easiest and maybe best solution but when you come through and in the end your code works out the feeling of accomplishment is addictive. I have started something (learning to programme) that I know will keep me interested and excited for a very long time to come. </p> </div>

<div class="col-md-6"> <p> I feel as though I work best in groups/teams. I think it has to do with knowing that im surrounded by intelligent, driven people whom I can learn from. There are so many interesting and important topics you can just from having a conversation. </p> </div> </div>


@media all and (min-width: 750px) { .display-none { display: none; } }

@media all and (max-width: 1026px) {

.paragraph3 { margin-top: 8%;

}

}

Steven Parker
Steven Parker
243,656 Points

In your first example, the media query applied to windows over 800px. But in this more recent one the media query applies to windows below 1026px.

They both work, but what is it you really want to happen?