Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Applying a style to a CSS ID within an ID

    I have a site where one page has,
    Code:
    <div id="page123">
         <div id="content"> ... </div>
     </div>
    How can I apply a style (from external stylesheet) to #content on only the page with id=page123 as opposed to other pages that have #content?

    Thanks in Advance!

    J

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Code:
    #page123 #content {
    /* styles go here */
    }
    Did you even try to do this on your own?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    Code:
    #page123 #content {
    /* styles go here */
    }
    Did you even try to do this on your own?
    Yes, tried that. It applied the style to the #page123 div as well as all pages with #content div.

  • #4
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by Jmartini View Post
    Yes, tried that. It applied the style to the #page123 div as well as all pages with #content div.
    You are mistaken. Either you used a comma in between the selectors or you're misinterpreting the result.

  • #5
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Got it working. I must have had a typo the other times. Thanks for pushing me back to it!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •