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 CSS Basics (2014) Enhancing the Design With CSS Adjusting the Layout with Media Queries

Shaked Gvirtsman
Shaked Gvirtsman
2,270 Points

I don't understand why when we added the "none" it displayed the border in the footer.

Why in the code when we added "border-top:none" then it suddenly appeared in the "main-footer" class. I thought It is supposed to disappear. this is the paragraph from the code:

@media (max-width: 768px)  {
  .primary-content,
  .secondary-content {
    width: 100%;
    padding: 20px;
    border-top: none;
  }

1 Answer

Justin Horner
STAFF
Justin Horner
Treehouse Guest Teacher

Hello Shaked Gvirtsman,

I believe what you're seeing when updating to border-top: none are the unspecified border values that are still in use, so it's defaulting to values that have been set outside of the media query. Here's what's happening.

Outside of the media query in the CSS file, there's a ruleset for .secondary-content that contains a declaration for border-bottom:

.secondary-content {
    padding-top: 80px;
    padding-bottom: 70px;
    border-bottom: 2px solid #dfe2e6;
}

In the media query, when setting border, it was setting all border sides to none which was overriding the border-bottom rule above and setting it to none.

When it was changed to border-top: none, it allowed the border-bottom to still apply, which means the border is not actually inside the footer, it is on the bottom of the .secondary-content.

I hope this helps.

Shaked Gvirtsman
Shaked Gvirtsman
2,270 Points

So, it means that except for the bottom borders the other ones will not be shown?

Justin Horner
Justin Horner
Treehouse Guest Teacher

Shaked Gvirtsman Yeah, setting border-top to none in the media query will only overwrite previous border-top declarations, leaving others like border-bottom to stay the same. Setting border to none in the media query will overwrite all other border declarations to none so no borders will be displayed for .primary-content and .secondary-content.