首页 > 试题广场 >

为了处理用户交互效果,你需要为 .button 添加悬停状态

[单选题]
为了处理用户交互效果,你需要为 .button 添加悬停状态,背景色从蓝色渐变为深蓝,过渡时间为0.3秒。下列哪个规则组正确实现这一效果且无性能问题?
  • .button { background-color: blue; transition: background-color 0.3s ease; } .button:hover { background-color: darkblue; }
  • .button:hover { background-color: darkblue; transition: background-color 0.3s; }
  • .button { background-color: blue; animation: colorChange 0.3s; } @keyframes colorChange { to { background-color: darkblue; } }
  • .button { background: linear-gradient(to right, blue, darkblue); transition: all 0.3s; }
居然选最简单的那个吗

发表于 2026-05-02 23:14:36 回复(0)