父div缩放到它里面的内容 [英] parent div scaling to content inside it

查看:96
本文介绍了父div缩放到它里面的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为一个父div会根据其中的内容自动缩放。
例如我有一个div作为其中的父母,我有另一个只有文本的div。当我通过萤火虫查看它的时候,它显示父窗格一直延伸到整个浏览器。我认为它应该只延伸到内部div内的文本的长度。如何使父级缩放到内部而不是完整的浏览器宽度。

 < div id =outter> 
< div id =inner>一些空文本< / div>
< / div>


解决方案

默认情况下,作为包含它的div。因此,您必须将div的大小设置为outter或默认为文档的100%


I thought a parent div automatically scales according to the content inside it. For example I have a div as a parent inside that I have another div with just text in it. When I view it through firebug its showing the parent div stretches all the way across the browser. I thought it should only stretch to the length of the text inside the inner div. How can I make the parent scale to the inner and not the full browser width.

<div id="outter">
    <div id="inner">some empty text</div>
</div>

解决方案

By default the div inside the other will be as large as the div containing it. So you must set the size of the div "outter" or by default it will be 100% of the document

这篇关于父div缩放到它里面的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆