Html css - 在其他方向扩展宽度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15494296/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
css - expand width in other direction
提问by Gregor Menih
I've got some icons that expands when I hover them:
我有一些图标会在我悬停它们时展开:
.icon
{
width: 128px;
height: 128px;
background: url(icons.png) no-repeat;
background-position: left top;
-webkit-transition: width .2s;
}
.icon.icon1:hover
{
width: 270px;
backgorund-position-x: -128px;
}
When I hover an icon it's width is changed, so because of the -webkit-transition is will expand the icon. The way it expands is from left to right which is good for .icon1 and .icon2, but it should be the other way around (right to left) with .icon3 and .icon4.
当我悬停一个图标时,它的宽度会发生变化,因此由于 -webkit-transition 将扩展图标。它扩展的方式是从左到右,这对 .icon1 和 .icon2 有利,但对于 .icon3 和 .icon4 应该是相反的(从右到左)。