473,474 Members | 1,681 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

this nested div question

Hi. I am attempting to achieve the following layout:

/------------------------------------\
| text text text text text text text text |
| text text text text text text text text |
| ---------------------------------- |
| text text text | text text text |
| text text text | text text text |
| text text text | text text text |
\------------------------------------/

This is something of a unique block giving company info. So the style
defining it will not repeat.

Here's the HTML:

<div id="Block1">
<p>
text text text text text text text text
text text text text text text text text
</p>
<div id="Col1">
<p>
text text text
text text text
text text text
</p>
</div>
<div id="Col2">
<p>
text text text
text text text
text text text
</p>
</div>

And here's what I imagine for the CSS:

#Block1 {
background-color: #CCCC99;
etc;
}

#Block1 #Col1 {
etc;
}

#Block1 #Col2 {
etc.
}

But this doesn't work. I've tried a few variations and still I can't seem to
apply the style to the 2 inner columns.

Any ideas?

Brian
Jul 20 '05 #1
5 5598

"William Tasso" <ng*@tbdata.com> wrote in message
news:bi************@ID-139074.news.uni-berlin.de...

I suspect the key is in the etc. Do you have a URL?


I don't have a URL. I'm localhosted.

Perhaps I should ask this question:

If I have a containing block, the style of which I may set using this CSS
rule:

#ContainingBlock1 {
/* rules */
}

How can I reference a div nested within a <div id="ContainingBlock">
element?

For example, <div class="Col1">?

#ContainingBlock div.Col1 {
/* rules */
}

doesn't work.

Brian
Jul 20 '05 #2
B McDonald wrote:

If I have a containing block, the style of which I may set using this CSS
rule:

#ContainingBlock1 {
/* rules */
}

How can I reference a div nested within a <div id="ContainingBlock">
element?
http://www.w3.org/TR/REC-CSS2/select...dant-selectors
http://www.w3.org/TR/REC-CSS2/select...hild-selectors
For example, <div class="Col1">?

#ContainingBlock div.Col1 {
/* rules */
}

doesn't work.


For your example, you forgot the "1" in the id name.

#ContainingBlock1 div.Col1 {
/* rules */
}

--
Brian
follow the directions in my address to email me

Jul 20 '05 #3
B McDonald / 2003-08-28 23:49:
Hi. I am attempting to achieve the following layout:
[Broken ASCII graphics removed. Please, use fixed width font to draw these.]

<div id="Block1">
<div id="Col1">
</div>
<div id="Col2">
</div>
</div>
And here's what I imagine for the CSS:

#Block1 {
background-color: #CCCC99;
etc;
}

#Block1 #Col1 {
etc;
}


You don't need ancestor selectors here because the "Col1" id is by
definition unique and you can simply select it with "#Col1". I'd
also suggest to always use all lowercase for id and class names
because you'll end up doing a typo sooner or later and some browsers
are known to make difference on letter case.

Are you sure you link the style correctly? Does
* { border: solid thick red; }
correctly add borders to every element on the page?

Have you already visited http://validator.w3.org/ and checked both
markup and CSS?

In the future, please, add URL. If the page isn't on a public
server, then make it so.

--
Mikko

Jul 20 '05 #4
Mikko Rantalainen wrote:
B McDonald / 2003-08-28 23:49:
<div id="Block1">
<div id="Col1">
</div>
<div id="Col2">
</div> [...] #Block1 #Col1 {
etc;
}

You don't need ancestor selectors here because the "Col1" id is by
definition unique and you can simply select it with "#Col1".


Maybe the div with id="Col1" appears within a div with id="Block2" in
another document referencing the same CSS.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)

Jul 20 '05 #5
Johannes Koch wrote:
Mikko Rantalainen wrote:
#Block1 #Col1 {


You don't need ancestor selectors here because the "Col1" id is by
definition unique and you can simply select it with "#Col1".


Maybe the div with id="Col1" appears within a div with id="Block2" in
another document referencing the same CSS.


Then one shouldn't use id but class instead, IMHO. It might be that
there's only one such element per page, but the real intent of that
element isn't unique but instead that element belongs to a class of
elements.

After saing that, I must admit that you're absolutely right and there's
nothing in the spec forcing to select ids directly without ancestor
selectors. And I never claimed anything like that.

--
Mikko

Jul 20 '05 #6

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

Similar topics

25
by: chad | last post by:
I am writing a program to do some reliability calculations that require several nested for-loops. However, I believe that as the models become more complex, the number of required for-loops will...
14
by: theo | last post by:
if I have nested div combinations, can I call for styles only to specific nested combos? It's 3 lists <li>, on one page, needing different styles. <div id=list1><li> <a id="t1"...
2
by: Alfonso Morra | last post by:
I have a (largish) "master" header file (>130 loc). I also have a number of seperate "satelite" header files which declare various objects used by the object declared in the "master" header file....
7
by: Alfonso Morra | last post by:
I have a class that contains a nested class. The outer class is called outer, and the nested class is called inner. When I try to compile the following code, I get a number of errors. It is not...
46
by: Neptune | last post by:
Hello. I am working my way through Zhang's "Teach yourself C in 24 hrs (2e)" (Sam's series), and for nested loops, he writes (p116) "It's often necessary to create a loop even when you are...
3
by: Derek | last post by:
I have a nested datalist with a dropdownlist. I need to capture the selectedvalue of the dropdownlist so I can update a database table. My question then is...how do I get the value from the...
20
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of...
7
by: biner.sebastien | last post by:
I have a problem understanding the scope of variable in nested function. I think I got it nailed to the following example copied from Learning Python 2nd edition page 205. Here is the code. def...
3
by: jdurancomas | last post by:
Dear all, I'm trying to declare the operator++ to a nested class. The nested class is not template but the container it is. The code used in teh sample program is included bellow: ...
1
by: dogbert1793 | last post by:
Can a ref class have a definition for a native class nested in it? The ref class would also have a native pointer to an instance of the nested class (which I know is ok).
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.