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

Vlad Legkowski
Vlad Legkowski
9,882 Points

Class is still displaying after setting display to none

Hi guys, I want to class .small-screen not to be displayed on screens wider than 640px.

But once i make window bigger than 640px this div is not disappearing.

2 Answers

Vlad Legkowski
Vlad Legkowski
9,882 Points
           <div class="small-screen">
  <h1 id="club-offcial-name-small">Hercules Club</h1>
  <h2 id="no-training-small"><q>Aqui nadie entrena</q></h2>
  </div>


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

I copy and pasted your code onto my page and it seems to be working. Maybe you have a specificity or source order problem. Can you show us more of the code?

[The following is the entirety of the index.html and responsive.css I used to test it]

<!DOCTYPE html>
<html>
   <head>
      <meta charset="utf-8">
      <title>Practice</title>
      <link rel="stylesheet" href="css/responsive.css">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
   </head>
   <body>
     <header>
       <div class="small-screen">
          <h1 id="club-offcial-name-small">Hercules Club</h1>
          <h2 id="no-training-small"><q>Aqui nadie entrena</q></h2>
       </div>
     </header>
   </body>
</html>
@media all and (min-width: 641px) {
  .small-screen {
    display: none;
    }
 }