Page 1 of 1

How does one reference <div> parameters?

Posted: Sat Dec 12, 2009 9:55 pm
by JackD
We have a web page with a floating sidebar and floating body. Is there a way in the body section to reference and use the height of the sidebar? Here is the sidebar definition:

.twoColLiqLtHdr #sidebar1 {
float: left;
width: 24%; /* top and bottom padding create visual space within this div */
background-image: url(images/red1%20background.jpg);
padding-top: 0px;
padding-right: 0;
padding-bottom: 0px;
padding-left: 0px;
}

.twoColLiqLtHdr #sidebar1 h3, .twoColLiqLtHdr #sidebar1 p {
margin-left: 0px; /* the left and right margin should be given to every element that will be placed in the side columns */
margin-right: 0px;
float: none;
background-image: none;
}

.twoColLiqLtHdr #container #sidebar1 {
color: #FFF;
height: 1000px;
font-size: large;
font-family: "Times New Roman", Times, serif;
font-weight: normal;
}

Here is the instantiation of the sidebar:

<div id="sidebar1">
.....
</div>

What I would like to be to do is something like:

.twoColLiqLtHdr #mainContent {
height: "sidebar1"->height;
........
}

Is it possible to do a reference like this and if so, how do you do it?

Re: How does one reference <div> parameters?

Posted: Sat Dec 12, 2009 10:44 pm
by requinix
IE has something. Besides that you'd have to use JavaScript.

I bet there's a CSS solution to your problem.

Re: How does one reference <div> parameters?

Posted: Sun Dec 13, 2009 9:52 am
by Cirdan
You could do something like

.columnHeight {
height: 100px;
}

then just add class="columnHeight" to both

This should be in the CSS board BTW

Re: How does one reference <div> parameters?

Posted: Sun Dec 13, 2009 5:58 pm
by JackD
Thanks, that will most likely work for what we need. Sidebar is set externally in a file, but the class will carry forward to the body. :P