[英]Require div to expand to contain content even larger than page width
I need to have a div stretch to contain the content when the content is larger than the div, even when the content stretches beyond the width of the html page. 当内容大于div时,即使内容超出html页面的宽度,我也需要进行div拉伸以包含内容。
Example HTML: HTML示例:
<body>
<div id="outerDiv">
<div id="innerDiv">asdfasdfkjasdflkjasldkfalsdkfjalsdkflaskdjfaslkdjfkalsjdhfkasjdhkljsdfashdjsdkjasfkjakfjhskdjfhakjdhkasjdhfsjdkashasjhkajsdkashkashfkajsdlfkjaskdjfhaksdjlaskjdkjdfhkasjdkajndckasjdbcjhsadcjkhasbdfhasbfjkasbdkjfnasdkcsdjfnaksjdfbaksdhfiweuhfjskdbfasjdfnasdfasdfasf
</div>
</div>
</body>
Example CSS: CSS示例:
#outerDiv
{
background-color: red;
}
#innerDiv
{
background-color: blue;
}
I have an example here: http://jsfiddle.net/978ew1jz/4/ 我在这里有一个例子: http : //jsfiddle.net/978ew1jz/4/
I want the blue div to stretch as long as the text does. 我希望蓝色div能够与文本一样长。
Edit: I also need the red div to still surround the blue div when the blue div stretches. 编辑:当蓝色div伸展时,我还需要红色div仍然围绕蓝色div。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.