Important: I'm using Twitter Bootstrap, so everything is with box-sizing: border-box
.
The difficulty is this: I have an element with absolute positioning. I want the width of it to be equal to that of the parent element:
div.elemento-filho {
position: absolute;
width: 100%;
}
That almost works. My problem is that the element is getting wider than the parent, because width
has included the parent's ( margin
) borders.
div.elemento-pai {
width: 180px;
margin: 0px 15px;
}
In this case, I would like the width of the child element not to consider the margins, that is, to measure 150px instead of 180px .
I can not set the width
of the child element, as it has to work for parents of different widths.
Can you do that? In what way?