[Resolved] Exclude one page (home page) from CSS rule?

Home Forums Support [Resolved] Exclude one page (home page) from CSS rule?

Home Forums Support Exclude one page (home page) from CSS rule?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1607803
    Emil

    Hi!

    I wanted the sidebar to not get smaller than 300px and got help to find this solution:


    @media
    (min-width: 769px) {
    #primary {
    width: calc(100% – 330px);
    }
    #right-sidebar {
    width: 330px;
    }
    }

    It works perfect!

    But the problem now is that I want the home page to be full width, without a sidebar. How can I exclude the homepage from this CSS code?

    Or can I do it some other way?

    #1607883
    David
    Staff
    Customer Support

    Hi there,

    you can change your CSS to exclude the home page:

    @media (min-width: 769px) {
        body:not(.home) #primary {
            width: calc(100% – 330px);
        }
    
        body:not(.home) #right-sidebar {
            width: 330px;
        }
    }
    #1607906
    Emil

    That code made the home page look good. But on all other pages with sidebar, the sidebar went down under the main content. Can you take a look at it, please?

    /Emil

    #1608100
    David
    Staff
    Customer Support

    Try manually retyping this line – looks some weird spacing character got copied over:

    width: calc(100% – 330px);

    #1608110
    Emil

    Great, that worked like a charm! Thank you!

    #1608114
    David
    Staff
    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.