Search code examples
cssopencartstylesheet

I want to change the css of a div on home page only but it should remain unchanged on other routes in opencart. Can anyone have an idea?


I have categories showing on home page just below the slider, I want to align it just aside the slider instead below it. I think that can be done by giving some negative top margin to that div. But problem is how can I do css for only home page not for other pages

Here is the link to that page which I want to change.

http://kiranalala.com/


Solution

  • Well I found the answer and it was quite simpler than i thought. Doing some CSS work as needed and preparing the required class,I used the php $_SERVER function to get over with the url problem.

    <?php if($_SERVER['REQUEST_URI']=='/')?>
       {
         echo $class ="the_class_needed_to_align_div";
       }
       else{
           echo $clasas = "default_class";
       }
    

    And then called $class variable in the div which needed to be realigned.