- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个应该很容易解决的问题,在 DIV
上用 overflow-y: auto
呈现垂直滚动条,但在 IE 和 IE 之间呈现不同火狐。简而言之,在 IE 中,滚动条出现在 DIV
的外部,而在 FF 中,它呈现在 DIV
的内部>。当元素接近列表中的最长项时,这会导致 FF 中的 DIV
中的元素出现不必要的换行(这反过来又会增加第一个 DIV
的宽度)地方)。
这是 HTML 的片段
<div class='helperList'>
<div class='helperListItem'>
<span>
Sample Data Item 1
<span class='helperItemExtraData'>
Data 1 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
</div>
helperList 的相关 CSS 是:
div.helperList{
display: flex;
flex-direction: column;
width: auto;
overflow-y: auto;
overflow-x: hidden;
height: 300px;
}
对于 helperItemExtraData:
span.helperItemExtraData{
float: right;
}
Firefox 渲染
IE11渲染
现在,这是列表生成代码的可重用模块的一部分,该代码模拟自动完成功能的下拉列表。外面的两个 DIV(helperList、helperListItem)是自动生成的,我无法更改它们。我可以控制进入每个 helperListItem DIV 的元素的呈现。这个特殊元素的不寻常之处在于它包含两条信息,目的是让第二条信息(“Data X Special Info”)右对齐,呈现两列的外观。
从机制上讲,就渲染带有垂直滚动条的列表而言,它在 IE11 和 FF 中都能正常工作。然而,当 FF 呈现列表,并使框的宽度与最长的元素匹配时,然后将垂直滚动条插入列表中,然后重排列表内容并在列表中最长元素的长度处或附近中断元素。相反,IE 将滚动条放在 DIV 外部,因此在所有情况下都能正确呈现元素。
我需要停止在 FF 中拆开/包装元素。到目前为止我已经尝试过的 - 我会预先承认其中一些显然是可以达到的,坦率地说,我正处于我确信我忽略了一个更简单的解决方案的地步(我的眼球正在转向此时的茶包):
可在以下位置找到一个工作 fiddle ,它说明了在两种不同浏览器中呈现时的差异:
https://jsfiddle.net/ykv3tu41/1/
如果可能的话,我怎样才能阻止 FireFox 将垂直滚动条放在列表 DIV 中,从而导致破坏元素?
我相信发布的问题 here正在处理一个非常相似(如果不完全相同?)的问题,但没有答案。
编辑:我开始认为这可能是描述为 here 的 flexbox 问题.
最佳答案
对于跨浏览器支持,将此添加到您的代码中:
div.helperListItem > span {
display: flex;
white-space: nowrap;
}
div.testContainer {
width: 500px;
height: 500px;
}
div.helperList {
position: absolute;
width: auto;
max-height: 300px;
display: flex;
flex-direction: column;
overflow-y: auto;
overflow-x: hidden;
z-index: 10;
}
div.helperListItem>span {
display: flex;
white-space: nowrap;
}
<div class='testContainer'>
<div class='helperList'>
<div class='helperListItem'>
<span>
Sample Data Item 1
<span class='helperItemExtraData'>
Data 1 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
<div class='helperListItem'>
<span>
Sample Data Item 2
<span class='helperItemExtraData'>
Data 2 Special Info
</span>
</span>
</div>
</div>
</div>
关于html - 克服 FireFox/IE 垂直滚动条渲染差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44728368/
据我所知,Marketo 将 REST API 请求的数量限制为每天 10,000 次。有没有办法克服这个限制?我可以支付并获得更多吗? 我发现 REST API 请求和 SOAP API 请求是分开
有谁知道有什么方法可以克服 NotSupportedException?我有一个针对用户的方法: public virtual bool IsAbove(User otherUser) {
我们最近从关系型 (MySQL) 转向 NoSQL (couchbase)。基本上它是社交手机游戏的后端。我们在扩展后端以处理越来越多的用户时面临着很多问题。当使用 MySQL 时,由于多个表之间存在
我当前用来收集文本的函数 InputBox 显然不能接受超过 255 个字符,并且我需要能够收集更多字符?我可以使用参数或不同的函数来增加此限制吗? 最佳答案 说句迂腐的话,输入框允许您输入最多 25
我是近似字符串匹配领域的新手。 我正在探索 Bitap algorithm 的用途,但到目前为止,它有限的模式长度让我很困扰。我正在使用 Flash,处理 32 位无符号整数和一个 IEEE-754
克服 PHP 中的大海捞针困惑的最实用方法是什么? 这里 $needle 是第一个参数 bool in_array ( mixed $needle , array $haystack [, bool
我有一个无法更改的客户端类。 List list1= Arrays.asList(1,2,3); System.out.println("Total sum is:"+sum(list1)); pri
我们都知道,在 Java 中,如果在 Abstract 类中声明一个 static 方法,该方法将属于 Abstract 类,而不是它的 child 。 (没有抽象静态) 我有一个简单的数据库系统,它
我有 4 个表和这个查询 SELECT tag.id, title FROM tag LEFT JOIN tag_map ON ( tag.id = tag_map.tag_id ) LEFT JOI
我有 4 个表和这个查询 SELECT tag.id, title FROM tag LEFT JOIN tag_map ON ( tag.id = tag_map.tag_id ) LEFT JOI
在 Swift 中,一切都以结构而不是类的形式实现。正在传入值,但内存地址不存储它们。这是一个例子: import UIKit var array = Array() array = [6,2,9,1
在我编写的 C++ 程序中: #include #include using namespace std; int main() { vector a; a.resize(1); f
我正在尝试使用 php_ldap(使用 ADLdap)从 Ubuntu(hardy 8.04LTS)主机绑定(bind)到 AD。在端口 389 上绑定(bind)到 ldap://myserver
这个问题在这里已经有了答案: Low picture/image quality when capture from camera (3 个答案) 关闭 5 年前。 我想从相机拍照并上传到服务器,但
我想将 unsigned char[8] 分配给 uint64(c 语言),使用 RPC 传递此值,并将 uint64 转换回具有相同字节顺序的 unsigned char[8](cpp 语言)。问题
Python 似乎对实例方法有一些限制。 无法复制实例方法。 不能 pickle 实例方法。 这对我来说是有问题的,因为我的工作是非常面向对象的 project我在其中引用了实例方法,并且同时使用了深
我理解这个问题,根据答案 here ,但是,我真的可以使用帮助或更详细的代码解释来说明它是如何克服的。 我的情况是这样的:我曾经将模型和 Controller 分开,在我的模型包中我有一个包含所有模型
假设我从这样的 Akka Persistence 系统开始: case class MyMessage(x: Int) class MyProcessor extends Processor {
我正在寻找在构建重量级 Windows 界面时处理用户对象句柄限制的高级策略。请说明您如何使用 SWT 或直接 Windows GUI API 克服或绕过此问题。我唯一不感兴趣的是优化小部件使用的策略
我有一个我知道过去的日期列表,但格式为 28/MAY/13 .用它们制作日期类的最接近的方法是基本的 dates as.Date("2013-12-31")] as.Date("2013-12-3
我是一名优秀的程序员,十分优秀!