I'ld like to have a parent element take it's child size. The problem is that I need the child element's width to be defined in percent (for it to be responsive).
I can't set the parent element to be 50% for example, because only the child has the class I need and the block size varies by this class. I am using isotope so some of this code can't be changed.
Here's an example code :
<div class="parent">
<div class="child size1">content</div>
</div>
<div class="parent">
<div class="child size2">content</div>
</div>
CSS :
.parent{
float: left;
margin: 0px 5px 10px 5px;
position: absolute;
left: 0px;
top: 0px;
-webkit-transform: translate3d(0px, 796px, 0px);
z-index: 20;
}
.size1{
width: 25%; /*I need the parent to take this size also -> 25% of the page */
}
.size2{
width: 50%; /*I need the parent to take this size also -> 50% of the page */
}
Anyone has a CSS solution ? If I can't figure it out, I'll use jquery but I don't want my website to get unnecessary js if there's an other solution....
Thanks !