【问题标题】:Create text boxes that change colour when hovered over创建在悬停时更改颜色的文本框
【发布时间】:2015-03-05 17:16:54
【问题描述】:

我正在尝试为我的网站创建文本框超链接。我想要透明框直到悬停在上面然后我想要框来改变颜色而不是文本。我想知道他们是否可以这样做?

【问题讨论】:

    标签: text colors hover


    【解决方案1】:

    使用 CSS,您需要将 background-color: yourcolor 添加到 hover 伪类。

    这里有一个例子:

    <!-- Here's the HTML -->
    <div class="myDiv">
      <p>Here is some text and then you will be <a href="mylink.html">linking</a> to another site</p>
    </div>
    

    然后在您的 CSS 中,您将拥有:

    .myDiv a:hover {
      background-color: red;
    }
    

    很简单。

    【讨论】:

      猜你喜欢
      • 2023-04-01
      • 2021-04-18
      • 1970-01-01
      • 1970-01-01
      • 2012-08-08
      • 2017-11-04
      • 1970-01-01
      • 2021-09-09
      相关资源
      最近更新 更多