WordPress.org

Forums

How can i apply CSS to different pages using a templates own Custom CSS sheet? (6 posts)

  1. enerdo
    Member
    Posted 4 years ago #

    Hello,

    I am using Custom CSS feature of a template to add my CSS. I am not using stylesheets phps. My problem is when i write css there it applies it to every page in the site.. Here in the main page (www.spor101.com) everything is perfect. But when i click a page the post is out of the page (like this http://www.spor101.com/?p=15) because i applied css to #content. Is there a way to fix this and apply css only to main page with using the templates css feature? Thank you.

  2. Michael
    Forum Moderator
    Posted 4 years ago #

    your theme uses body_class() - http://codex.wordpress.org/Function_Reference/body_class

    the main page for instance has the css class .home

    use those css classes to distinguish between posts and pages or even individual posts or pages.

    to find out which classes are present, use a tool such as Firebug http://getfirebug.com/

  3. enerdo
    Member
    Posted 4 years ago #

    Thank you.. I am using firebug yes. I am not editing css in .php files as i said, i am using the templates CSS editor. I added css like the following to that editor.. How will i make these apply to .home and not to other pages? Thank you very much for your help, i know i am an amateur :)

    [CSS code moderated - a link to your site is enough to access the styles]

  4. enerdo
    Member
    Posted 4 years ago #

    I found it :) I just add .home infront of the #xxx and it works... Thank you again.. Do you know what to write to change it only in pages? .page?

  5. Ravinder Kumar
    Member
    Posted 4 years ago #

    you can give custom css to page by creating the page template.and apply all you css (class and ids)and if you want same change occur in all pages then make changes in page.php as you want.

  6. enerdo
    Member
    Posted 4 years ago #

    what is the alternatife of .home to apply css to pages only? I tried .page but it did not work..

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.