css HTML Button problem in page builder(Beaver图片)

roqulrg3  于 2023-07-01  发布在  其他
关注(0)|答案(1)|浏览(144)

所以我有个问题我使用Beaver Builder创建我的页面。每当我使用html按钮与合并的css在它和悬停动画-每当我激活悬停默认按钮是可见的。我不知道怎么修救命!!!!
so this is the button and how it should look like when in hover mode:
and this is how it looks like:
你能帮我想个办法吗?

  1. button {
  2. color: #2e276d;
  3. text-decoration: none;
  4. font-size: 20px;
  5. border: none;
  6. background: none;
  7. font-weight: 600;
  8. font-family: 'Poppins', sans-serif;
  9. }
  10. button::before {
  11. margin-left: auto;
  12. }
  13. button::after,
  14. button::before {
  15. content: '';
  16. width: 0%;
  17. height: 2px;
  18. background: #f44336;
  19. display: block;
  20. transition: 0.5s;
  21. }
  22. button:hover::after, button:hover::before {
  23. width: 100%;
  24. }
  1. <button>
  2. HOVER ME
  3. </button>
k5ifujac

k5ifujac1#

这可能是你在CSS中针对同一个按钮,也是在CSS代码中的其他地方或通过Beaver构建器本身针对的。
如果需要,您可以将!important添加到CSS规则中。但我不推荐这样做,除非真的需要,因为这会覆盖代码中其他地方应用的所有其他CSS规则。
下面是一个例子,我如何使用颜色红色!important,后来试图改变它与不同的颜色,* 这不工作 *。

  1. button {
  2. color: red !important; // this will always be applied
  3. }
  4. button {
  5. color: #2e276d; // This will not be applied, because of the !imporant above
  6. text-decoration: none;
  7. font-size: 20px;
  8. border: none;
  9. background: none;
  10. font-weight: 600;
  11. font-family: 'Poppins', sans-serif;
  12. }
  13. button::before {
  14. margin-left: auto;
  15. }
  16. button::after,
  17. button::before {
  18. content: '';
  19. width: 0%;
  20. height: 2px;
  21. background: #f44336;
  22. display: block;
  23. transition: 0.5s;
  24. }
  25. button:hover::after, button:hover::before {
  26. width: 100%;
  27. }
  1. <button>
  2. HOVER ME
  3. </button>

我建议在使用之前检查一下你的代码,看看应用的默认规则是从哪里来的(如果可能的话,修改一下)!CSS中重要规则。
我建议为您要定位的按钮使用特定的类,并将CSS应用于该类,而不是定位按钮本身,以避免全局覆盖CSS规则。
更多信息:!important rule CSS

展开查看全部

相关问题