Html 将SCSS/CSS悬停在图像上
我想把鼠标悬停在一个盒子上,变换图像的比例(1.1)。但问题是我在图像前面有一个文本。因此,如果我在文本上悬停,它将不起作用 我想将鼠标悬停在盒子上的任何位置并缩放图像 这是我的密码 HTMLHtml 将SCSS/CSS悬停在图像上,html,css,sass,Html,Css,Sass,我想把鼠标悬停在一个盒子上,变换图像的比例(1.1)。但问题是我在图像前面有一个文本。因此,如果我在文本上悬停,它将不起作用 我想将鼠标悬停在盒子上的任何位置并缩放图像 这是我的密码 HTML 与其缩放图像悬停时的图像,不如缩放其父元素悬停时的图像,该父元素包括图像和文本 &--nation:hover > image { //scale to 1.1 } 编辑:您的代码如下 .club-index { &__box {
与其缩放图像悬停时的图像,不如缩放其父元素悬停时的图像,该父元素包括图像和文本
&--nation:hover > image {
//scale to 1.1
}
编辑:您的代码如下
.club-index {
&__box {
margin-top: 30px;
&--nation {
position: relative;
display: block;
width: 100%;
height: 250px;
margin: 0 auto;
background-color: #18202d;
text-align: center;
overflow: hidden;
}
&--nation:hover > &--image {
transform: scale(1.1);
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
-o-transform: scale(1.1);
}
&--image {
position: absolute;
transition: all 1s ease-in-out 0s;
-moz-transition: all 1s ease-in-out 0s;
-webkit-transition: all 1s ease-in-out 0s;
-o-transition: all 1s ease-in-out 0s;
}
&--nation:hover > image {
//scale to 1.1
}
.club-index {
&__box {
margin-top: 30px;
&--nation {
position: relative;
display: block;
width: 100%;
height: 250px;
margin: 0 auto;
background-color: #18202d;
text-align: center;
overflow: hidden;
}
&--nation:hover > &--image {
transform: scale(1.1);
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
-o-transform: scale(1.1);
}
&--image {
position: absolute;
transition: all 1s ease-in-out 0s;
-moz-transition: all 1s ease-in-out 0s;
-webkit-transition: all 1s ease-in-out 0s;
-o-transition: all 1s ease-in-out 0s;
}