Suppose I have the following HTML code:
-
Since position: absolute; and viewport width were no options in my special case, there is another quick solution to solve the problem. The only condition is, that overflow in x-direction is not necessary for your website.
You can define negative margins for your element:
#help_panel {
margin-left: -9999px;
margin-right: -9999px;
}
But since we get overflow doing this, we have to avoid overflow in x-direction globally e.g. for body:
body {
overflow-x: hidden;
}
You can set padding to choose the size of your content.
Note that this solution does not bring 100% width for content, but it is helpful in cases where you need e.g. a background color which has full width with a content still depending on container.