Style Sheet Coding (5 posts)

  1. moeryan18
    Posted 3 years ago #

    Hi Everyone,

    I am creating a website where I want the index page to be designed differently than the secondary pages. How do I separate the CSS code for the index page from the rest of the CSS code? Do I just separate it out with comments?

    Sorry, I am just not sure how to organize the coding.

    Thanks for your time!

  2. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    Add the body_class() function within your <body> HTML element.

    You can then identify pages with their page id classes.

  3. moeryan18
    Posted 3 years ago #

    Great, thank you. I know it's a really basic question, but it's my first website I'm trying to do with WordPress and I'm basically styling/designing from scratch.

    Much appreaciated!

  4. Jose Castaneda
    Posted 3 years ago #

    One way of doing it would be creating two different stylesheets and loading them through a conditional test. Not sure if you are PHP savvy but that is one way. Using comments is also another way of separating the code and is a great way of documenting why you did what you did for future reference.

  5. moeryan18
    Posted 3 years ago #

    Hi Jose,

    No I'm not very PHP savvy, only slightly familiar...thanks for the tip though, I will maybe learn in the future. Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic