Pretty much as per the title really.
Is it safe to use the following CSS to make the element fit to its parent’s width?
.element {
position: absolute;
left: 0;
right: 0;
background-color: #ccc;
border-top: 1px solid #ddd;
}
We can ignore IE < 8.
It is safe. But don’t hold me to it. This statement is provided as is, without warranty of any kind.
Here’s a nice article: Conflicting Absolute Positions
Also, the parent needs to have position applied (i.e. other than
static, usuallyrelative).