473,385 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

selector using body class

I wish to select and style elements in a page having a body of a given
class.

<body class="page">
<div class="inside">
<div id="a">
<p>Content of #a</p>
</div>
<div class="b">
<p>Content of class .b</p>
<div class="c">
<p>Content of .c</p>
</div>
</div>
</div>
</body>

I've had trouble selecting the content of #a, .b and .c.

For example, those don't work in the stylesheet:

body.page div.inside #a { style statements }
body.page .b { style statements }
body.page div.inside .b { style statements }
body.page div.c {style statement }

--

Haines Brown, KB1GRM

Nov 2 '07 #1
4 2138
Jukka K. Korpela schreef:
Scripsit Haines Brown:

>I've had trouble selecting the content of #a, .b and .c.

Please post a URL that demonstrates the problem, explain why you think
there is a problem caused by selector issues, and identify the
browser(s) you used for testing.

Haines,

you better follow Jukka's advice and provide us with a URL
because the example you posted is working fine in my browser.

--
Rob
Nov 2 '07 #2
Rob Waaijenberg <ro************@hotmail.comwrites:
you better follow Jukka's advice and provide us with a URL
because the example you posted is working fine in my browser.
Rob,

Indeed. I has a small markup error that killed the whole works, and
when corrected I had no problem getting the selectors to work. Sorry
to have been difficult.

--

Haines Brown, KB1GRM

Nov 3 '07 #3
On Fri, 2 Nov 2007 20:12:17 +0200, "Jukka K. Korpela"
<jk******@cs.tut.fiwrote:
>I wish to select and style elements in a page having a body of a given
class.

Why? There is only one body element on a page, so there's seldom any reason
to assign a class to it.
There's very frequently a reason to class a body element - when you
share an external stylesheet across many pages. This can obviously be
sub-types of page within a site. It could even be a simple way to
roll-out Google-like date-based rebranding of a page simply by flipping
<bodyto <body class="halloween" >
Nov 3 '07 #4
Scripsit Andy Dingley:
There's very frequently a reason to class a body element - when you
share an external stylesheet across many pages.
I think it would be more natural to use distinct stylesheets, with @import
directives taking care of using those rules that should be applied to all
(or most) pages. This would make the dependancy clearer: this stylesheet
associates with this page, as opposite to coding the dependancy into
selectors and therefore making selectors (which can be rather complicated
for other reasons) more complicated.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Nov 3 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: | last post by:
I am hoping a mixed ASP- Javascript programmer could help me with this scenario: I have a list box populated with randomized records (NewID()) from a Broker (Salesperson) sql server table. ...
6
by: Richard Barnet | last post by:
Dear CSS gurus, My question regarding 'the cascade' is a simple one, but one that I haven't heard anyone talk about before: When cascading (for instance, when applying two linked stylesheets),...
4
by: Zane | last post by:
Hi, I am having some grieve with the following part of my CSS, basically when using a composite selector using an ID as the first element the it doesn't display the expected results. Am I doing...
3
by: Lian Liming | last post by:
Hi, The language in my web site may be Simplified Chinese or English. I want to define different styles for each language. For each language, the http header is different. <meta name="language"...
2
by: tagbert | last post by:
I'm trying to localize the setting of colors on a series of webpages by defining color palettes that will be used for various page areas. I've defined some palette classes like .clrLt, .clrMd,...
1
by: jorgedec | last post by:
I have two test vertical menus. If I apply a border-bottom using a selecter of div.vbar a It looks fine. If I apply the border-bottom using a selecter of div.vbar ul li a
6
by: _googlepost | last post by:
I have some CSS that goes something like this: table.TableStyle {font-family: "Helvetica", "Ariel"; background- color:white; border-collapse:collapse;} table.TableStyle COLGROUP { background-...
3
by: RobG | last post by:
The link below is to a CSS selector test suite that tests 6 popular libraries: <URL: http://ajaxian.com/archives/slickspeed-css-selector-testsuite It might be of interest to some. -- Rob
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.