Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-11-2010, 03:28 PM   PM User | #1
Jmartini
New to the CF scene

 
Join Date: Jun 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Jmartini is an unknown quantity at this point
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
Jmartini is offline   Reply With Quote
Old 06-11-2010, 03:30 PM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 06-11-2010, 03:40 PM   PM User | #3
Jmartini
New to the CF scene

 
Join Date: Jun 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Jmartini is an unknown quantity at this point
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.
Jmartini is offline   Reply With Quote
Old 06-11-2010, 03:43 PM   PM User | #4
Apostropartheid
The Apostate


 
Apostropartheid's Avatar
 
Join Date: Oct 2007
Posts: 3,215
Thanks: 16
Thanked 265 Times in 263 Posts
Apostropartheid is on a distinguished road
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.
__________________
Blog | Twitter
Useful links: W3C HTML Validator | W3C CSS Validator | HTML 5 Guide
CF: HTML & CSS Resources/Tutorials Thread | HTML & CSS Posting Rules and Guidelines
Remember: no link, no code, no help!
Apostropartheid is offline   Reply With Quote
Old 06-11-2010, 04:10 PM   PM User | #5
Jmartini
New to the CF scene

 
Join Date: Jun 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Jmartini is an unknown quantity at this point
Got it working. I must have had a typo the other times. Thanks for pushing me back to it!
Jmartini is offline   Reply With Quote
Reply

Bookmarks

Tags
css, nested id

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:34 AM.


Advertisement
Log in to turn off these ads.