office-ui-fabric-react - 更改 Fluent UI 面板上的退出按钮样式
问题描述
我在 React 中使用来自“office-ui-fabric-react/lib/Panel”的面板。
此面板在右上角生成一个小 [x] 按钮。很难看,有没有办法将其默认背景颜色更改为红色并修改其鼠标悬停值?
解决方案
您可以轻松更改Panel Componentbutton style
的throughstyles
属性:
styles={{
closeButton: {
backgroundColor: '#f00',
},
}}
如果要更改hover style
of button
,则必须使用selectors
属性:
styles={{
closeButton: {
backgroundColor: '#f00',
selectors: {
':hover': {
backgroundColor: '#000'
},
},
},
}}
面板组件:
<Panel
styles={{
closeButton: {
backgroundColor: '#f00',
selectors: {
':hover': {
backgroundColor: '#000'
},
},
},
}}
/>
有用的链接:
推荐阅读
- html - 通过固定编号的 CSS 打破项目?
- java - PrintWriter 在执行 close() 函数之前擦除文件内容
- java - WebSockets 请求中请求的资源上不存在“Access-Control-Allow-Origin”标头
- python - 如何使用 LINE 聊天机器人“reply_message 功能”向用户回复多条消息
- javascript - 在填充有 jQuery val() 的 jQuery 日期选择器上触发“更改”事件不起作用
- html - 事务性电子邮件 - Magento 1.9 中的默认样式和变量
- google-apps-script - 在包含字符串的单元格中的每个字符之后插入一个字符串
- sql - 访问 SQL 交叉表函数 SELECT TOP 1
- c - 二进制文件的打印名称
- security - 是否可以停止复制 docker 图像?