How does one reference <div> parameters?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JackD
Forum Commoner
Posts: 62
Joined: Sat Dec 12, 2009 6:25 pm

How does one reference <div> parameters?

Post 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?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How does one reference <div> parameters?

Post by requinix »

IE has something. Besides that you'd have to use JavaScript.

I bet there's a CSS solution to your problem.
Cirdan
Forum Contributor
Posts: 144
Joined: Sat Nov 01, 2008 3:20 pm

Re: How does one reference <div> parameters?

Post 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
JackD
Forum Commoner
Posts: 62
Joined: Sat Dec 12, 2009 6:25 pm

Re: How does one reference <div> parameters?

Post 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
Post Reply