如何使用“left:100%”CSS规则保留DIV宽度
If placing an absolute position with left:100%
, the DIV
will not reserve the normal width depending on its content. Instead, the width will be minimized by breaking the text over spaces.
如果放置一个左边的绝对位置:100%,DIV将不会保留正常宽度,具体取决于其内容。相反,通过在空格上打破文本来最小化宽度。
Here is a simple EXAMPLE
这是一个简单的例子
How is it possible to place an absolute position with left:100%
(which is located just outside the parent), but keeping the DIV
content (text) in one line.
如何用左边放置绝对位置:100%(位于父节点之外),但将DIV内容(文本)保持在一行中。
Note that the text length and DIV
width are unknown, as the width must be set according to the inner content.
请注意,文本长度和DIV宽度是未知的,因为必须根据内部内容设置宽度。
2 个解决方案
#1
3
If all you want is for your absolute div to have his text on one line you can put:
如果你想要的只是你的绝对div将他的文字放在一行上你可以放:
white-space:nowrap;
jsFiddle
Is this what you're after?
这就是你要追求的吗?
更多相关文章
- DiggBar如何基于不在其域上的内容动态调整其iframe的高度?
- IE-7 z-index问题-下拉区域在横幅下,它的内容没有显示在IE-7中。
- PHP选择具有特定宽度的图像并构建网格
- 提交一个表单(后台生成id),点击保存并一步后切换到下一个tab中,此t
- 在Paragraphs中显示mysql内容时出现问题
- thinkphp5使用workerman定时器定时爬取某站点新闻资讯等内容
- PHP调用内容DES加密的SOAP接口
- PHP限制HTML内容中图片必须是本站的方法
- 将Ajax div内容存储在PHP变量中