restrict sidebar only to home page

  • Author
  • #1340333



    My sidebar keeps showing on every page,I want to restrict it only to my home page,how can I do that?

    The blog I need help with is



    This thread will be moved to the CSS Forum for you. Please do not create a duplicate thread.



    ok thank you!


    One way would be to hide it everywhere and then unhide it using the “.home” body class selector.

    Here is a basic example:

    #secondary {
    	display: none;
    .home #secondary {
    	display: block;

    Try coming up with the CSS you would need to adjust the width of the main content column with a similar set of code.

    To learn more about CSS, start here!



    Thank you! by width of main content column which area do you exactly mean? as I am discovering the right design for my website and CSS commands both at the same time and same pace !!!


    You’re doing great!

    by width of main content column which area do you exactly mean?

    Check out this example. It shows the web inspector in the Chrome browser. To find it, I right-clicked on the main content area on the page then I looked in the HTML panel on the left until I found the container for the content. When you click on the container HTML element on the left, you will see all of the CSS that applies to the element you clicked on in the right panel. So, in this example, you can see how the theme has used the “.content-area” selector and set the width to 42.7451%

The topic ‘restrict sidebar only to home page’ is closed to new replies.