react antd 样式修改

这篇具有很好参考价值的文章主要介绍了react antd 样式修改。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

最近在做一个大数据的大屏ui更改,使用的是antd,需要根据ui稿调很多的antd组件样式
特做一个样式修改记录,也给需要的人一些帮助

我们修改的有以下样式:

react antd 样式修改,react.js,前端,前端框架

 react antd 样式修改,react.js,前端,前端框架

 react antd 样式修改,react.js,前端,前端框架

 react antd 样式修改,react.js,前端,前端框架

 react antd 样式修改,react.js,前端,前端框架

 react antd 样式修改,react.js,前端,前端框架

 文章来源地址https://www.toymoban.com/news/detail-521525.html

如何改呢:

react antd 样式修改,react.js,前端,前端框架

 

/*
  修改 antd 组件样式
*/

// 仅 drop 下的下拉框改变样式
:global {
  .ant-select-dropdown {
    background-color: #0e053a;
    border-width: 1;
    border-color: #fff;
    color: #57f3fe;
    border-style: inherit;

    .ant-empty-small {
      color: #23116d;
    }

    .ant-select-item.ant-select-item-option {
      color: #57f3fe;
      background-color: transparent;
      font-size: 14px !important;
      font-family: 'yanhei' !important;
    }

    .ant-select-item-option-active:not(.ant-select-item-option-disabled) {
      color: #57f3fe;
      background-color: transparent;
      font-size: 14px !important;
      font-family: 'yanhei' !important;
    }
  }

  [class^="ant-select"],
  [class*=" ant-select"] {
    color: #57f3fe;
    font-size: 14px !important;
    font-family: 'yanhei' !important;
    font-weight: 400 !important;
  }
}

// selected 选项框的默认样式
:global {
  .ant-select:not(.ant-select-customize-input) .ant-select-selector {
    position: relative !important;
    border: 0px !important;
    color: #56dcff !important;
    height: 40px !important;
    background-color: transparent !important;
    background: url('../../static/bigdataimg/similarityCheck/bg_search_input@2x.png') 100% no-repeat;
    background-size: 100% 100%;
  }

  .ant-select-single.ant-select-open .ant-select-selection-item {
    color: #56dcff !important;
    font-size: 14px !important;
    font-family: 'yanhei' !important;

  }

  .ant-select-single .ant-select-selector {
    box-sizing: border-box;
    margin: 0px;
    color: #56dcff !important;
    font-size: 14px !important;
    font-family: 'yanhei' !important;
    list-style: none;
    border-radius: 0px;
    display: flex;
    align-items: center;
  }

  .ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input {
    height: 40px;
    display: flex;
    align-items: center;

    &::placeholder {
      color: #56dcff !important;
      display: block;
    }
  }

  .ant-select .ant-select-selection-placeholder {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    // margin-top: 8px;
    display: flex;
    align-items: center;
    color: #56dcff;
    font-weight: 400;
    font-size: 14px !important;
    font-family: 'yanhei' !important;
    pointer-events: none;
  }

  .ant-select ant-select ant-select-in-form-item ant-select-focused ant-select-single ant-select-show-arrow ant-select-open>.ant-select-selector>.ant-select-selection-item {
    color: #56dcff;
    font-size: 14px !important;
    font-family: 'yanhei' !important;
  }

  .ant-select .ant-select-selector {
    color: #56dcff;
  }
}

// input
:global {
  .ant-input {
    background-color: transparent !important;
    border-width: 0px !important;
    border-radius: 0px !important;
    // height: 40px;
    // line-height: 40px;
    display: block;
    color: #56dcff !important;
    font-size: 14px;
    font-family: yanhei !important;
    font-weight: 400 !important;
    border: 0px !important;

    &::placeholder {
      color: #56dcff !important;
      display: block;
      font-size: 14px !important;
      font-family: yanhei !important;
      font-weight: 400 !important;
    }
  }

  [class^="ant-form"],
  [class*=" ant-form"] {
    font-family: 'yanhei' !important;
    font-size: 14px !important;
  }

  .ant-form-item .ant-form-item-explain-error {
    font-family: 'yanhei' !important;
    font-size: 14px !important;
  }

  .ant-input header_product {
    display: flex;
    align-items: center;
  }

  .ant-input:hover {
    background-color: transparent !important;
  }

  .ant-input:focus,
  .ant-input-focused {
    background-color: transparent !important;
    box-shadow: none;
  }

  .ant-textarea.ant-input {
    vertical-align: middle;
  }

  .ant-input ant-input-status-success header_product {
    background-color: transparent !important;
  }

  input:-internal-autofill-selected {
    box-shadow: inset 0 0 0 1000px #281840 !important; // 改变了背景色
    -webkit-text-fill-color: #56dcff; // 改变了字体颜色
  }

  input:-internal-autofill-previewed {
    box-shadow: inset 0 0 0 1000px #281840 !important; // 改变了背景色
    -webkit-text-fill-color: #56dcff; // 改变了字体颜色
  }

  .ant-input-number .ant-input-number-input {
    font-family: 'yanhei' !important;
  }

  .ant-form-item .ant-form-item-control-input {
    min-height: 1px !important;
  }
}

// table
:global {
  .ant-table-wrapper .ant-table-thead>tr>th {
    text-align: center !important;
    background: transparent !important;
    color: #5cd3ff;
    font-size: 14px;
    font-family: 'yanhei' !important;
    font-weight: 400;
  }

  .ant-table-wrapper .ant-table {
    background: transparent !important;
    color: #5cd3ff !important;
  }

  .ant-table-container {
    background: transparent !important;
  }

  //箭头 颜色
  .ant-table-wrapper .ant-table-column-sorter-up.active,
  .ant-table-wrapper .ant-table-column-sorter-down.active {
    color: white;
  }

  //header右边滚动条颜色
  .ant-table-wrapper .ant-table-cell-scrollbar:not([rowspan]) {
    box-shadow: 0 0px 0 0px transparent;
  }

  .ant-table-placeholder {
    background: transparent;
  }

  .ant-table-wrapper .ant-table-tbody>tr.ant-table-placeholder:hover>th,
  .ant-table-wrapper .ant-table-tbody>tr.ant-table-placeholder:hover>td,
  .ant-table-wrapper .ant-table-tbody>tr.ant-table-placeholder {
    background: transparent;
  }

  .ant-table-wrapper .ant-table-tbody>tr.ant-table-placeholder {
    background: transparent;
  }

  // 文字提示颜色
  .ant-empty-normal .ant-empty-description {
    color: white !important;
  }

  // cell字体颜色
  .ant-table-thead>tr>th {
    color: #5cd3ff !important;
  }

  //footer title color
  .ant-pagination-total-text {
    color: #56dcff !important;
    font-size: 14px !important;
  }

  // .ant-pagination-item-link> * {
  //   font-size: 14px !important;
  // }


  // footer page arrow color
  .ant-pagination-item-link {
    color: #56dcff !important;
  }

  // set cell header footer title padding
  .ant-table-wrapper .ant-table.ant-table-small .ant-table-title,
  .ant-table-wrapper .ant-table.ant-table-small .ant-table-footer,
  .ant-table-wrapper .ant-table.ant-table-small .ant-table-thead>tr>th,
  .ant-table-wrapper .ant-table.ant-table-small .ant-table-tbody>tr>th,
  .ant-table-wrapper .ant-table.ant-table-small .ant-table-tbody>tr>td,
  .ant-table-wrapper .ant-table.ant-table-small tfoot>tr>th,
  .ant-table-wrapper .ant-table.ant-table-small tfoot>tr>td {
    padding: 2px 1px 2px 2px;
  }

  // table cotainer padding
  .ant-spin-container {
    padding: 10px 20px;
  }

  .ant-pagination .ant-pagination-disabled .ant-pagination-item-link,
  .ant-pagination .ant-pagination-disabled:hover .ant-pagination-item-link {
    color: rgba(1, 1, 1, 0.5) !important;
  }

  // 设置 cell and header padding 内边距
  .ant-table-wrapper .ant-table-thead>tr>th {
    text-align: left !important;
  }

  .ant-table-wrapper .ant-table-thead>tr>th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before,
  .ant-table-wrapper .ant-table-thead>tr>td:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
    background-color: transparent !important;
  }

  .ant-table ant-table-empty ant-table-fixed-header {
    background: transparent !important;
    background-color: transparent !important;

    .ant-table-container {
      background-color: transparent !important;

      .ant-table-cell {
        background-color: transparent !important;
      }
    }
  }

  .ant-table-wrapper .ant-table-thead>tr>th,
  .ant-table-wrapper .ant-table-thead>tr>td {
    background: transparent !important;
    border-bottom: 0px solid transparent !important; // 隐藏header cell分割线
  }

  .ant-table-body .ant-table-cell {
    border-bottom: 0px solid black !important; // 隐藏cell分割线
    background-color: transparent !important;
  }

  .ant-table-wrapper .ant-table-thead>tr>th::before {
    width: 0px !important;
  }

  .ant-table-thead>tr>th {
    color: #5cd3ff !important;
  }

  .ant-table-wrapper td.ant-table-column-sort {
    background: transparent !important;
  }

  // 隐藏滚动条
  .ant-table-body::-webkit-scrollbar {
    width: 1px;
    display: none;
  }

  // 修改分页文字颜色
  .ant-pagination .ant-pagination-item a {
    color: #56dcff !important;
  }

  .ant-pagination-item-link {
    color: #56dcff !important;
  }

  .ant-pagination .ant-pagination-disabled .ant-pagination-item-link {
    color: #56dcff !important;
  }

  [class^="ant-table"],
  [class*=" ant-table"] {
    color: #5cd3ff !important;
    font-size: 16px !important;
    font-family: 'yanhei' !important;
    font-weight: 400 !important;
  }

  [class^="ant-pagination"],
  [class*=" ant-pagination"] {
    font-family: 'yanhei' !important;
  }

  .ant-empty-description {
    font-size: 14px !important;
    font-family: 'yanhei' !important;
  }
}

// input-number
:global {
  .ant-input-number-input {
    background-color: transparent !important;
    border-width: 0px !important;
    border-radius: 0px !important;
    height: 40px;
    color: #5cd3ff !important;
    border: 0px !important;

    &::placeholder {
      color: #56dcff !important;
    }
  }

  .ant-input-number {
    background-color: transparent !important;
    border-width: 0px !important;
    border-radius: 0px !important;
    padding: 0px;
    height: 40px;
    color: #5cd3ff !important;
    border: 0px !important;

    &::placeholder {
      color: #56dcff !important;
    }
  }
}

:global {
  .ant-picker .ant-picker-input>input {
    // 字体颜色
    color: #56dcff !important;
    font-size: 14px !important;
    font-family: 'yanhei' !important;

    &::placeholder {
      color: #56dcff !important;
      font-size: 14px !important;
      font-family: 'yanhei' !important;
    }

    //icon颜色
    .ant-picker .ant-picker-suffix {
      color: #56dcff;
    }
  }

  //icon颜色
  .ant-picker .ant-picker-suffix {
    color: #56dcff;
  }

  //鼠标悬浮字体颜色(年月)
  .ant-picker-dropdown .ant-picker-header-view button:hover {
    color: #56dcff !important;
    font-size: 14px !important;
  }

  //鼠标悬浮字体颜色(日)
  .ant-picker-cell:hover {
    color: #56dcff !important;
    font-size: 14px !important;
  }

  //选择颜色(日)
  .ant-picker-dropdown .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner,
  .ant-picker-dropdown .ant-picker-cell-in-view.ant-picker-cell-range-start .ant-picker-cell-inner,
  .ant-picker-dropdown .ant-picker-cell-in-view.ant-picker-cell-range-end .ant-picker-cell-inner {
    color: #56dcff !important;
  }

  [class^="ant-select"],
  [class*=" ant-select"] {
    font-family: 'yanhei' !important;
  }

}

// antd 全局分页设置
:global {

  // 分页文本框样式设置
  .ant-pagination.ant-pagination-simple .ant-pagination-simple-pager input {
    background: url('../../static/bigdataimg/similarityCheck/but_page@2x.png') 100% no-repeat;
    background-size: 100% 100%;
    background-color: transparent !important;
    border-width: 0px;
    min-height: 24px !important;
    min-height: 28px !important;
    min-width: 40px !important;
    font-size: 13px !important;
    font-family: 'yanhei' !important;
    text-align: center !important;
  }

  // 字体颜色
  .ant-pagination-simple-pager {
    color: #56dcff !important;
    font-size: 14px !important;
    font-family: 'yanhei' !important;
  }

  // 文字居左显示
  .ant-pagination .ant-pagination-total-text {
    flex: 1;
    font-size: 14px !important;
    font-family: 'yanhei' !important;
  }
}

// antd 消息弹窗
:global {

  //消息高度
  .ant-message {
    top: 15% !important;
    color: #57f3fe !important;
    font-family: 'yanhei' !important;
  }

  //消息div 背景和圆角边线
  .ant-message-notice-content {
    background: #0d0538 !important;
    border: 2px solid #57f3fe;
  }

  //消息div 图片颜色
  .ant-message-error>.anticon {
    color: #57f3fe !important;
    font-family: 'yanhei' !important;
  }

}

// antd 右侧消息弹窗
:global {

  //消息高度
  .ant-notification {
    right: auto !important;
    top: 15% !important;
    left: 50% !important;
    position: absolute !important;
    transform: translate(-50%, -50%) !important; //再左右即-50%自身的一半,完成居中
    font-family: 'yanhei' !important;
  }

  //消息div 背景和圆角边线
  .ant-notification-notice {
    background: #0d0538 !important;
    border: 2px solid #57f3fe;
  }

  //消息div 图片颜色
  .ant-notification-notice-with-icon>* {
    color: #57f3fe !important;
    font-family: 'yanhei' !important;
  }

}

//antd 图片loading
:global {
  .ant-image .ant-image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
  }
}

到了这里,关于react antd 样式修改的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 前端框架之争:Vue.js vs. React.js vs. Angular

    🎉欢迎来到Web前端专栏~前端框架之争:Vue.js vs. React.js vs. Angular ☆* o(≧▽≦)o *☆嗨~我是IT·陈寒🍹 ✨博客主页:IT·陈寒的博客 🎈该系列文章专栏:架构设计 📜其他专栏:Java学习路线 Java面试技巧 Java实战项目 AIGC人工智能 数据结构学习 🍹文章作者技术和水平有限,如果

    2024年02月07日
    浏览(82)
  • 如何使用前端框架(React、Angular、Vue.js等)?该如何选择?

    聚沙成塔·每天进步一点点 前端入门之旅:探索Web开发的奇妙世界 欢迎来到前端入门之旅!感兴趣的可以订阅本专栏哦!这个专栏是为那些对Web开发感兴趣、刚刚踏入前端领域的朋友们量身打造的。无论你是完全的新手还是有一些基础的开发者,这里都将为你提供一个系统而

    2024年02月07日
    浏览(47)
  • 【react框架】结合antd做表单组件的一些心得记录

    作为一个前端最常遇见的需求场景就是写表单、写表格。写多了会逐渐的积累一些开发心得,此文章根据我使用vue和react的经验记录了一些东西,抛砖引玉的给大家看看。 举例react项目,在做表单的很多时候,我都是从antd上把其中一个form组件例子复制下来,然后再看看提供了

    2024年02月07日
    浏览(84)
  • 前端基本功 用 React Hooks + Antd 实现一个 Todo-List

    To-do list(待办事项列表)是用来记录和管理要完成的任务、活动或项目的列表。它是一种简单而常见的工具,用于帮助人们组织和安排日常生活中的任务。每当您有一项任务需要完成或者要记住某些事情时,您可以将它添加到待办事项列表中。 学习前端的一些新知识时,经

    2024年02月17日
    浏览(26)
  • 简介:在这篇教程中,我们将使用React.js框架创建一个简单的聊天机器人的前端界面,并利用Dialogflo

    作者:禅与计算机程序设计艺术 介绍及动机 聊天机器人(Chatbot)一直是互联网领域中的热门话题。而很多聊天机器人的功能都依赖于人工智能(AI)技术。越来越多的企业希望拥有自己的聊天机器人系统,从而提升自己的竞争力。为此,业界也出现了很多基于开源技术或云

    2024年02月06日
    浏览(42)
  • ruoyi框架修改左侧菜单样式

    ruoyi前端框架左侧的菜单很丑,我们需要修改一下样式,下面直接看效果。 因为navbar这个文件,好多页面都引用了,所以在这个页面写的样式会全局通用。 经过上面的代码,就可以有左侧菜单的效果。 -----华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码-----

    2024年02月07日
    浏览(29)
  • 【Vue项目搭建】修改【若依框架】的侧边栏、导航栏、面包屑样式、修改全局页面样式

    掌握分寸感,找目标一致的人协同你,有效地调配资源,就可以提高效率。 写在前面的话 :博主最近想要搭建自己的前端若依项目,因此此系列博客会做一些记录。我的项目gitee地址: https://gitee.com/xuruicong/rachel-front-show 说明:只运行前端项目,只需要要下载官方项目http:

    2024年01月19日
    浏览(74)
  • 前端导出表格 修改样式(xlsx-style)用法

            xlsx-style 修改样式的机制  就是选中哪一行,那一列或者哪一个  然后去修改  比如表格最左上角的一个格子 坐标是 (0, 0) 下标  也可以叫做  A1 选中之后   可以修改其样式  1. 下载依赖   首先下载依赖到项目 2. 引入到项目 3. 创建导出表格         为什么

    2024年02月13日
    浏览(39)
  • uni-app:js修改元素样式(宽度、外边距)

    效果 代码 1、在 view 元素上添加一个 ref 属性 ,用于在JavaScript代码中获取对该元素的引用:view ref=\\\" myView \\\" id=\\\"mybox\\\"/view 2、获取元素引用 :const viewElement = this.$refs. myView .$el; 3、修改元素宽度:viewElement.style.width = \\\'100px\\\'; 4、修改元素左外边距:viewElement.style.marginLeft = \\\'20px\\\'; 这种

    2024年02月07日
    浏览(36)
  • 使用vite创建Vue/React前端项目,配置@别名和Sass样式,又快又方便

    Vite官方网站:Vite | 下一代的前端工具链  Vite 并不是基于 Webpack 的,它有自己的开发服务器,利用浏览器中的原生 ES 模块。这种架构使得 Vite 比 Webpack 的开发服务器快了好几个数量级。Vite 采用 Rollup 进行构建,速度也更快。  兼容性注意 Vite 需要 Node.js 版本 14.18+,16+。然

    2024年02月14日
    浏览(37)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包