tags:

views:

233

answers:

1

I have a css class where the LEFT needs the be the WIDTH of the parent node.

The width of the parent node is unknown.

Is there a way to get the width of a parent node in CSS. (expressions are not an option).

Thanks.

.parent{
   display:block; 
   position:relative;
}

.child{
   position:absolute;
   left:PARENT.WIDTH;
}


<div class="parent">This is a test<span class="child">what?</span></div>

Hopefully that makes sense.

Thanks.

+1  A: 
.parent{
   display:block; 
   position:relative;
}

.child{
   position:absolute;
   right:-100px;
   width:100px;
}


<div class="parent">This is a test<span class="child">what?</span></div>
Marius