css - scss或css,当它是焦点时如何旋转箭头图像
问题描述
我试图在焦点集中但不起作用时旋转箭头图像。
我只想旋转箭头图像。当我scss focus code
参加其他课程时,它可以工作。
react.js 制作按钮组件。
function LinkButton ({title, icon}, children) {
return (
<button className="btn">
{/* TODO: only when node has children, show the arrow image */}
<img className={`menu-arrow-img`} src={arrow} alt="" />
<img className="icon" src={icon} alt="" />
<div className="btn-title">
{title}
</div>
</button>
);
};
粗鲁的
@mixin transform($property) {
-webkit-transform: $property;
-ms-transform: $property;
transform: $property;
}
.btn {
display: flex;
justify-content: space-between;
align-items: center;
text-align: left;
width: 180px;
height: 40px;
font-size: 14px;
color: #3b4757;
background-color: white;
border: 0;
border-radius: 0 100px 100px 0;
cursor: pointer;
.menu-arrow-img {
width: 16px;
height: 13px;
&:focus {
@include transform(rotate(90deg));
}
}
.icon {
width: 15px;
}
.btn-title {
width: 120px;
}
&:hover {
background-color: #ebeff8;
}
&:focus {
background-color: #ebeff8;
}
}
我错过了什么吗?以及如何仅旋转箭头图像?
解决方案
当按钮获得焦点时,您应该将转换添加到图标
所以应该是:
.btn:focus {
.menu-arrow-img {
@include transform(rotate(90deg));
}
}
推荐阅读
- reactjs - 通过平滑滚动应用持续时间
- python - Django Admin:应用程序部分而不是身份验证部分中的自定义用户模型
- javascript - 从异步函数返回 https 获取请求正文值
- node.js - nodejs 已经是最新版本但没有找到
- javascript - jQuery Datatables Uncaught TypeError 无法设置未定义的属性“nTf”
- npm - What does OR operator mean in package.json for an npm package's version?
- c# - 动态设置变量名称为文本框名称
- alexa - ALEXA 通过 EVENTS 网关异步发送响应
- python - Selenium 在 python 中查找元素
- mysql - 如何使用布尔条件搜索大数据 - Mysql