简体   繁体   English

自动调整CSS div内容

[英]auto adjustable css div content

I am trying to auto adjustable content with css divs. 我正在尝试使用CSS div自动调整内容。 I am struck at div width. 我对div宽度感到震惊。 Below is my code. 下面是我的代码。 I am attaching screen what exactly my requirement should be. 我要附上屏幕,究竟我的要求应该是什么。 You can understand if you see the screen attached. 您可以了解是否看到了所附的屏幕。

http://jsfiddle.net/266PG/44/ http://jsfiddle.net/266PG/44/

Please can anybody solve this problem. 请谁能解决这个问题。

This is what i want 这就是我要的

在此处输入图片说明

You can try with this sample 您可以尝试此示例

<div id="outerDiv" class="autosize">
    <div id="innerDiv" runat="server" style="display: block">
        //Content...
    </div>
</div>

CSS: CSS:

#outerDiv
{
    min-height: 200px; 
}

div.autosize { display: table; width: 1px; }
div.autosize > div { display: table-cell; }

Just use 只需使用

width: auto

and don't use fixed widths for inside divs. 且内部div请勿使用固定宽度。 Maybe you could define max-width property for outer div 也许您可以为外部div定义max-width属性

您可以使用:

div {float:left;overflow:hidden;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM