transform: scale() 悬停模糊
transform: scale() Hover Blur
似乎在使用"transform: scale()"时会暂时模糊图像和文字。 My fiddle 和代码:
HTML:
<table>
<tbody>
<tr>
<!-- The current Image Sources are just PLACEHOLDERS. It is not the final img sources path. -->
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing1">The Test</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing2">Testtest Testtesttesttest</div>
</td>a
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing1">TESt</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing1">Testt TesttTest</div>
</td>
</tr>
<tr>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing2">TestTest Testtest</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing2">Test Testtest tests</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing2">testtest testtest</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing1">Testtesttesttest</div>
</td>
</tr>
</tbody>
</table>
CSS:
table, th, td {
border: 1px solid #8a9398;
border-collapse: collapse;
box-shadow: inset 1px 1px 0px 1px white;
table-layout: fixed;
}
td {
text-align: center;
width: 148px;
height: 180px;
color: #48515b;
cursor: pointer;
}
td:hover{
-ms-transition-duration: 0.2s;
-ms-transform: scale(1.1);
-webkit-transition-duration: 0.2s;
-webkit-transform: scale(1.1);
box-shadow: 0 0 0 0;
}
td:active {
-ms-transition-duration: 0.1s;
-ms-transform: scale(0.95);
-webkit-transition-duration: 0.1s;
-webkit-transform: scale(0.95);
box-shadow: 0 0 0 0;
}
我已经尝试了一些解决方法,例如使用宽度和高度进行过渡,但这会使所有其他 table 单元格展开。有什么解决办法吗?
将初始大小设置为您要使用的最大比例,并以较小的比例开始。这是一个 fiddle 您必须将 td
的宽度变大,但添加 padding
Read more
我解决了
您需要做的就是在 table 单元格中赋予内容自己的 div,然后使用宽度和过渡来制作悬停效果。确保给 table-cell "overflow: hidden".
似乎在使用"transform: scale()"时会暂时模糊图像和文字。 My fiddle 和代码:
HTML:
<table>
<tbody>
<tr>
<!-- The current Image Sources are just PLACEHOLDERS. It is not the final img sources path. -->
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing1">The Test</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing2">Testtest Testtesttesttest</div>
</td>a
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing1">TESt</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing1">Testt TesttTest</div>
</td>
</tr>
<tr>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing2">TestTest Testtest</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing2">Test Testtest tests</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing2">testtest testtest</div>
</td>
<td>
<img src="http://opensource.org/files/osi_keyhole_100X100_90ppi.png" width="100px" height="100px">
<div class="rndSpacing1">Testtesttesttest</div>
</td>
</tr>
</tbody>
</table>
CSS:
table, th, td {
border: 1px solid #8a9398;
border-collapse: collapse;
box-shadow: inset 1px 1px 0px 1px white;
table-layout: fixed;
}
td {
text-align: center;
width: 148px;
height: 180px;
color: #48515b;
cursor: pointer;
}
td:hover{
-ms-transition-duration: 0.2s;
-ms-transform: scale(1.1);
-webkit-transition-duration: 0.2s;
-webkit-transform: scale(1.1);
box-shadow: 0 0 0 0;
}
td:active {
-ms-transition-duration: 0.1s;
-ms-transform: scale(0.95);
-webkit-transition-duration: 0.1s;
-webkit-transform: scale(0.95);
box-shadow: 0 0 0 0;
}
我已经尝试了一些解决方法,例如使用宽度和高度进行过渡,但这会使所有其他 table 单元格展开。有什么解决办法吗?
将初始大小设置为您要使用的最大比例,并以较小的比例开始。这是一个 fiddle 您必须将 td
的宽度变大,但添加 padding
Read more
我解决了
您需要做的就是在 table 单元格中赋予内容自己的 div,然后使用宽度和过渡来制作悬停效果。确保给 table-cell "overflow: hidden".