Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Issue with div not lining up when using media query Reply To: Issue with div not lining up when using media query

#164488
Atelierbram
Participant

When making this a specificity battle

@media screen and (max-width: 480px) {
  #sidebar {
    background: #fff;
    margin-top: 20px;
    padding: 2%;
    width: 100%;
    float: none !important;
    }
} 

Doing it like this, float: none !important or float: left !important will override the float: right on the body #sidebar, body.ms #sidebar outside of the media-query. Curious about the tools you use, and current workflow. Do you check your site sometimes with W3C validator?

Can you maybe share:

  • why you prefer id– over class-selectors in your CSS
  • reasons why you use the XHTML strict doctype, instead of HTML5 <!doctype html>

Seeing a lot of ‘issues’, and don’t want to be pedantic, for instance: including the jQuery library three times is supposedly by accident.

updated Codepen