html - When i hover my icon for make it bigger, my page moving
问题描述
When i put my cursor on my icon , my icon font size is growing up so div being little bigger and its make move page a little and its not looking cool. How can i make it without make my div bigger ? My Code :
<div className="bg-gray-100 ratingWidth tomiddle p-6 rounded-lg text-center">
Aradığınız yanıtı bulabildiniz mi ?
<div className="mt-3 space-x-5 h-full "> //My icon Div
<span className="ti-thumb-up ratingEase "></span> //My icons
<span className="ti-thumb-down ratingEase"></span>
<br />
</div>
</div>
Css :
.ratingWidth {
width: 96%;
height: 100%;
}
.ratingEase {
transition: 0.2s;
font-size: 50px;
}
.ratingEase:hover {
transition: 0.2s;
transition-timing-function: ease;
font-size: 54px;
}
解决方案
You can position the element with absolute. This property makes it so that your icon does not alter any other item in the DOM. Even if you move, transform or do anything to this element, the others will not move.
.ratingEase {
transition: 0.2s;
font-size: 50px;
position: absolute;
}
推荐阅读
- firebase - 如何从 firebase 获取数据(如包含 url、inkwell 对象和字符串的新闻文章)到颤振应用程序中?
- ios - 尝试在苹果硅 m1 上运行 libtorch helloworld pod install 仍然出错
- django - 带有 django 频道后端的 Flutter 聊天应用程序不断重新加载
- python - OCR:从文本文档中分离手写文本
- json - JSON获取值而不使用数组中的位置
- html - Shapefile 未显示在传单地图中
- python - Lambda 路径参数嵌入在路径字典中
- python - Python是否在每个步骤中计算列表理解条件?
- python - 如果 K 相同,为什么 Kmeans 会产生相同的质心
- php - 未找到列:1054 'where 子句'中的未知列 'MONTH(date)'