Css float 而不移动其他 float

标签 css css-float

我想将 5 张图片并排放置;在悬停其中任何一个时,我希望悬停在图像上的宽度增加而不会将其旁边的图像推离它。我希望一切都留在原地,但要让悬停在上方的图片变大。我该怎么做。

最佳答案

Live demo

你好,现在已经习惯了这个没有 float 的 css

CSS

.parent{
border:solid 1px red;
  width:100px;
  white-space:nowrap;
  font-size:0;
}
.parent img{
border:solid 1px black;
  vertical-align:top;
}

HTML

<div class="parent">
<img src="http://www.gravatar.com/avatar/8193632933d351ea68ec1eae12f82057?s=32&d=identicon&r=PG">
<img src="http://www.gravatar.com/avatar/8193632933d351ea68ec1eae12f82057?s=32&d=identicon&r=PG">
  <img src="http://www.gravatar.com/avatar/8193632933d351ea68ec1eae12f82057?s=32&d=identicon&r=PG">
    <img src="http://www.gravatar.com/avatar/8193632933d351ea68ec1eae12f82057?s=32&d=identicon&r=PG">
      <img src="http://www.gravatar.com/avatar/8193632933d351ea68ec1eae12f82057?s=32&d=identicon&r=PG">
</div>

Live demo

----------------


Updated demo

关于Css float 而不移动其他 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13151585/

相关文章:

css - Bootstrap 3 列仅在纵向 View 中换行

css - 如何在不同的行上向右浮动两个 span 标签?

html - 移动端和桌面端相同 div 的不同样式

javascript - 如何在输入脚本的同一个 div 中添加图像(数组中的拆分字符串,每个索引中有 .png 字符串连接)

html - 有没有办法找到我的 HTML 代码使用的所有 CSS 代码?

javascript - 在一个 img src 标签上显示不同格式的普通图像和 base64 图像

CSS - 网格/砌体布局

css - 当菜单最后呈现时让博客文本环绕菜单 DIV

css - <span> float 在 <li> 内,在 FF 中创建新行,但在 Chrome 中不创建新行

CSS 有没有像 float : up? 这样的东西