首页 > 解决方案 > Css:我怎样才能从右到左显示这个图像?

问题描述

CSS新手在这里。我有这张图片,我想从右到左显示它,我必须添加/更改此代码什么?

.arr1 {
    display:block;
    position:absolute;
    left:1001px;
    top:920px;
    width:0;
    height:99px;
    background:url(../img/arr1.png) no-repeat;
    background-size:254px 99px;
    opacity: 0;
    transition: 0.5s linear;
    pointer-events: none;

    &:hover{
    opacity: 1;
    pointer-events: all;
    width: 254px;
    transition-delay: 1s;
    }
}

标签: csscss-transitionstransitionright-to-left

解决方案


没有更多代码很难给出可靠的答案,但是根据您发布的内容,将容器的绝对位置更改为,right而不是left将图像的宽度添加到前一个left值,得到 1255px:

.arr1 {
    display:block;
    position:absolute;
    right:1255px;
    top:920px;
    width:0;
    height:99px;
    background:url(../img/arr1.png) no-repeat;
    background-size:254px 99px;
    opacity: 0;
    transition: 0.5s linear;
    pointer-events: none;

    &:hover{
    opacity: 1;
    pointer-events: all;
    width: 254px;
    transition-delay: 1s;
    }
}

您可能还想添加background-position: right.arr1,具体取决于您希望图像的显示方式。


推荐阅读