如何在div中选择我的标签来改变悬停时的颜色?

时间:2016-07-01 23:00:32

标签: html css hover

无法弄清楚如何在(gdb) print (unsigned long long [4])*($rsi) $8 = {140737488347644, 140737488347708, 140737488347714, 140737488347721} (gdb) print (char[5])*(140737488347708) $9 = "first" 内访问我的a,因此div可以在i上更改颜色。

CODE:

:hover
.menu a {
  padding: 8px;
  margin-bottom: 20px;
  color: #ffffff;
  background-color: #18973c;
  font-family: "Exo", sans-serif;
  box-shadow: 0 2px 3px darkGray, 0 2px 3px lightGray;
  border-radius: 5px;
  width: 200px;
  text-decoration: none;
  text-align: center;
  display: block;
}
.menu a:hover {
  background-color: #ff6633;
}

<body> <div class="row"> <div class="col-3 menu"> <a href=""> Begin Addition Quiz </a> <a href=""> Begin Subtraction Quiz </a> <a href=""> Begin Multiplication Quiz </a> <a href=""> Begin Division Quiz </a> </div> <div class="col-9"> <h1> Get Ready To Succeed In Math! </h1> <p>Click any button on the left to begin a mathematics quiz in that subject. Once you are finished you will be given your score! <p>With this website, you will never fail another math test again! </div> </div>不允许我访问我在上面创建的按钮。

2 个答案:

答案 0 :(得分:0)

您的代码应该可以正常工作,由于已经有其他规则,可能会被覆盖。

  • 您可以尝试在规则中进行更多指定,方法是在其中添加父级。

如果你想要的是改变文字的颜色,那么你必须在color

中使用background-color属性而不是:hover属性

&#13;
&#13;
.row .menu a {
  padding: 8px;
  margin-bottom: 20px;
  color: #fff;
  background-color: #18973c;
  font-family: "Exo", sans-serif;
  box-shadow: 0 2px 3px darkGray, 0 2px 3px lightGray;
  border-radius: 5px;
  width: 200px;
  text-decoration: none;
  text-align: center;
  display: block;
}
.row .menu a:hover {
  background-color: #f63;
  color: red /* if you want to chang the text color */
}
&#13;
<div class="row">
  <div class="col-3 menu">
    <a href=""> Begin Addition Quiz </a>
    <a href=""> Begin Subtraction Quiz </a>
    <a href=""> Begin Multiplication Quiz </a>
    <a href=""> Begin Division Quiz </a>
  </div>
  <div class="col-9">
    <h1> Get Ready To Succeed In Math! </h1>
    <p>Click any button on the left to begin a mathematics quiz in that subject. Once you are finished you will be given your score!
      <p>With this website, you will never fail another math test again!
  </div>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

在悬停时更改文字颜色,如下所示。

&#13;
&#13;
.menu a {
  padding: 8px;
  margin-bottom: 20px;
  color: #ffffff;
  background-color: #18973c;
  font-family: "Exo", sans-serif;
  box-shadow: 0 2px 3px darkGray, 0 2px 3px lightGray;
  border-radius: 5px;
  width: 200px;
  text-decoration: none;
  text-align: center;
  display: block;
}
.menu a:hover {
  background-color: #ff6633;
  color:blue;
}
&#13;
<body>
  <div class="row">

    <div class="col-3 menu">
      <a href=""> Begin Addition Quiz </a>
      <a href=""> Begin Subtraction Quiz </a>
      <a href=""> Begin Multiplication Quiz </a>
      <a href=""> Begin Division Quiz </a>
    </div>

    <div class="col-9">
      <h1> Get Ready To Succeed In Math! </h1>
      <p>Click any button on the left to begin a mathematics quiz in that subject. Once you are finished you will be given your score!
        <p>With this website, you will never fail another math test again!
    </div>
  </div>
&#13;
&#13;
&#13;