- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在为我的元素使用 Twitter Bootstraps 网格。我有以下 HTML:
<div class="row-fluid">
<div class="span4 item">
<div class="inner">Some text</div>
</div>
<div class="span4 item">
<div class="inner">Some text</div>
</div>
<div class="span4 item">
<div class="inner">Some text</div>
</div>
</div>
和以下 CSS:
.item {
position: relative;
}
.item .inner {
background: #fff;
}
.item:hover .inner,
.item .inner:hover { // I did them both because on mobile it catches only the first
position: absolute;
}
结果是当我悬停“.item .inner”时,元素的长度与“.item”相同。在“.inner”内部我可能有宽度未知的图像,我希望这些图像在鼠标悬停时拉伸(stretch)到它们的真实宽度但是因为“.item .inner”被限制为“.item”的宽度(可能是任何东西,取决于用户屏幕)“.item .inner”不会拉伸(stretch)。
我想也许可以从“.item”中删除“position: relative”,这允许“.item .inner:hover”根据需要扩展,但如果内容短于“.item”的宽度,它会缩小 - 这是我不想发生的特征
如何实现它?
编辑:
在第一种情况下,您可以看到我现在所拥有的 - 当您将鼠标悬停在文本上时,它会失去宽度 - 但如果您将鼠标悬停在图像上,它会拉伸(stretch)。 http://jsfiddle.net/g5nP7/
在这种情况下,您可以看到,如果将鼠标悬停在文本上,它不会失去宽度,但如果将鼠标悬停在图像上,它不会拉伸(stretch)。 http://jsfiddle.net/dT7c5/4/
我想要的是当你悬停一个文本时——只有当里面的内容比悬停时元素的宽度长时,它才会拉伸(stretch)。如果内容比元素短,我不希望它缩小
同样如您在两个示例中所见,如果您将鼠标悬停在图像上,它会失去高度并迫使其他元素上升。
最佳答案
我能想出的唯一纯 CSS 解决方案是结合使用 max-width
和 min-width
,去掉 max-悬停时的宽度
。 Bootstrap 让它更难使用,但本质上我删除了 span4
CSS 并使用媒体查询来实现非常相似的效果
... Some other CSS ...
.item .inner {
...
width:auto;
}
.item:hover .inner, .item .inner:hover {
max-width:none;
}
.span4.item { width:auto; }
@media screen and (min-width:980px) {
.item .inner {
min-width:265px;
max-width:265px;
}
}
@media screen and (max-width:980px) and (min-width:770px) {
.item .inner {
min-width:200px;
max-width:200px;
}
}
Demo here .它不是 100% 完美的,因为它使用媒体查询断点而不是 Bootstrap 使用的那种网格系统(我尝试使用百分比宽度来模仿原始功能但它破坏了它),但是对于媒体查询很难区分。唯一的问题是您可能想要为更大的屏幕添加另一个媒体查询,以使其更适合屏幕
关于html - 如果 child 较小,则继承父宽度 - child 定位绝对,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20203019/
是否可以告诉hive某个表“很小”,即应将其复制到所有节点并在RAM中进行操作? 最佳答案 尝试以下提示: /*+ MAPJOIN(small_table) */ UPDATE 顺便说一句,还有其他
给定的是一个大(但不是巨大)的字符串数组(数量为 1000-5000 个单个字符串)。我想对这些字符串执行一些计算和其他操作。因为在处理那个大数组时它总是停止工作,所以我重写了我的函数以递归地获取较小
当我在大小为 (640,480) 的 JFrame 中添加 JPanel 时,JPanel 的大小为 (638449)。我需要 JPanel 与 JFrame 完全匹配! 我发现的一个临时解决方法是将
我目前正在尝试响应设计。我需要在父 div 变小的同时保持图像居中。 见图片说明: 我不想用它作为背景。下面的代码会一直把它放在div框的左上角 #img_wrap {
当我必须捕获生成器中可能发生的异常时,如何使 try block 尽可能小? 典型的情况是这样的: for i in g(): process(i) 如果 g() 可以引发我需要捕获的异常,第一种
目前尝试让 Accordion 项目在 Bootstrap 中工作一切都很好,直到我尝试关闭所有 Accordion 菜单。突然之间,标题比未折叠时小得多。 当一个打开时 当全部关闭时 我正在使用指南
目前尝试让 Accordion 项目在 Bootstrap 中工作一切都很好,直到我尝试关闭所有 Accordion 菜单。突然之间,标题比未折叠时小得多。 当一个打开时 当全部关闭时 我正在使用指南
一个应用程序托管一个具有三个接口(interface)的 Web 服务,用于三个单独且独立的操作,所有这些操作都在应用程序的不同组件中实现,彼此独立,例如在不同的包等中,所以他们对彼此了解不多,只共享
我正在尝试使用 border-radius 属性设计一个主要内容容器具有圆 Angular 的网站。但是,我保持侧边栏和顶部导航栏固定,因此当用户向上或向下滚动时它们不会移动。它类似于在 Google
我正在构建我网站的响应式版本。 虽然我很高兴大多数 float 的 div 被迫在屏幕下方,但有一些 div 我需要保持彼此相邻,即使屏幕区域小于这些 div 的总宽度。在这种情况下,我想按比例缩小它
我正在为我的元素使用 Twitter Bootstraps 网格。我有以下 HTML: Some text Some text
我有一个小宽度的 div 并且可以看到溢出。我有一个更大的表,里面只有一个单元格和一个文本: A small text with spaces...
我有一个设计得很好的架构,其中 Controller 转到访问与数据库通信的存储库的服务。 因此, Controller 中的逻辑保持在最低限度,但我仍然有非常微妙的代码片段来执行一些任务,例如 验证
我在一个布局中有两个 View 。我将分别称它们为 View A 和 View B。 ┌──────┐ │┌─┐┌─┐│ ││A││B││ │└─┘└─┘│ └──────┘ 父布局(包括View A
整个页面的父元素是一个居中的 div,最大宽度限制为 960px。页面上的所有其他元素都是该父 div 的子元素。简化结构如下: 虽然父 div 的宽度不应超过 960px,但我
我应该链接到完整的 jQuery UI -还是-提供精简的自定义副本? 来自 Google 等 CDN 的完整 jQuery-UI 与提供定制的最小版本之间存在非常显着的大小差异。此外,还可以将 jQ
我正在尝试制作一条图像拇指的“线”,它在鼠标移动时滚动。我让它工作了,但我现在的问题是我想在侧面做一个“填充”,这样我就不必将鼠标一直拉到侧面才能看到第一个/最后一个拇指。但我真的无法让它工作:/ 这
我是一名优秀的程序员,十分优秀!