javascript - 将非事件图像保留在顶部

标签 javascript html css

所以我有一些图像,当您点击时它们会变大。然而,当图像变大时,未被点击的图像移动到包含 div 的底部。示例:http://jsbin.com/losuniti/1/edit?html,css,output我怎样才能强制未点击的图像只停留在 div 的顶部?我试过使用

    .images img { top: 0 !important; }

最佳答案

将 vertical-align:top 添加到图像 img 选择器:

    .images img {
      vertical-align:top;
        display:inline-block;
        position:relative;
         top: 0 !important;}

我想这就是你想要的。

关于javascript - 将非事件图像保留在顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24691136/

相关文章:

javascript - 选择器不会在react-native-elements中渲染

javascript - 为什么 vscode 打印 "undefined"作为结果

javascript - 未提供 HTMLScriptElement 的所有属性时出现 typescript 错误

html - Twitter Bootstrap : pull-right class only working in Firefox for input-group

jquery - 更改兄弟节点为标签的文本节点

javascript - jquery scrollToFixed 在到达页面顶部时停止

html - 如何调整背景颜色的大小并调整其位置?

javascript - 使用 <img src =""标签在 php 中获取图像

javascript - 如何关闭此 jQuery Toggle 函数

css - 使用 CSS 样式图像文本输入框的光标放置