简体   繁体   English

Hover 效果在 css 中没有响应

[英]Hover effect not responding in css

Hello can someone help me with hover effect in .todo-button:hover I tried a lot of versions but nothing seems to work i mean zero response from a browser:( There must be some mistake in .todo-button construction it seems您好,有人可以帮我解决.todo-button:hover中的 hover 效果我尝试了很多版本,但似乎没有任何效果,我的意思是浏览器的零响应:( .todo-button构造中一定有一些错误

 * { box-sizing: flex-box; margin: 0; padding: 0; font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif; }.todo-button { width: 100px; padding: 16px; border: none; border-radius: 0 4px 4px 0; cursor: pointer; outline: none; background: linear-gradient( 90deg, rgba(93, 12, 255, 1) 0%, rgba(155, 0, 250, 1) 100%); color: #fff; text-transform: capitalize; }.todo-button:hover { background-color: #3e8e41; }

In your class you use property background which overwrites the property background-color even it is used in a hover class.在您的 class 中,您使用的属性background会覆盖属性background-color即使它用于 hover class。 Just change hover class to:只需将 hover class 更改为:

.todo-button:hover {
  background: #3e8e41;
}

plz try this code请试试这个代码

 * { box-sizing: flex-box; margin: 0; padding: 0; font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif; }.todo-button { width: 100px; padding: 16px; border: none; border-radius: 0 4px 4px 0; cursor: pointer; outline: none; background: linear-gradient( 90deg, rgba(93, 12, 255, 1) 0%, rgba(155, 0, 250, 1) 100%); color: #fff; text-transform: capitalize; }.todo-button:hover { background: #3e8e41; }
 <,DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width. initial-scale=1.0"> <style> </style> <title>Document</title> </head> <body> <button name="btn" class="todo-button">submit </button> </body> </html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM