html - 在 iframe 中打开链接时如何使背景色变为绿色?

标签 html css

i write the code of this image.i want to make background-color green when link is open in iframe.ifreame i present below the navigation bar

我可以使用 css 执行此操作吗?我尝试使用 :active 选择器,但它不适用于 iframe。有没有其他方法让它看起来像这样?

     <style>
      a.lis:active {
          background-color: #4CAF50;
      }

      a.lis {
          color: white;
          font-size: 19px;
          text-align: center;
          font-weight: 10px;
          text-decoration: none;
          margin-bottom: 0px;
          float: left;
          disply: inline-block;
          height: 30px;
          background-color: #5F5F5F;
          padding: 14px 10px 10px 5px;
      }

      a.lis:hover {
          background-color: #4CAF50;
      }
  </style>
  <ul class="list">
      <li class="icolist">
          <img class="icohome" src="home.png" width="25px" height="25px" target="ifrm">
      </li>
      <li><a target="ifrm">Best places</a>
      </li>
      <li><a class="lis" href="http://localhost/signup.php" target="ifrm">Hotels</a>
      </li>
      <li><a class="lis" href="#" target="ifrm">Videos</a>
      </li>
      <li><a class="lis" href="#" target="ifrm">Best routes</a>
      </li>
  </ul>

最佳答案

我解决了这个问题,我使用了 :focus selector for links,它运行良好。感谢所有给出答案的人

关于html - 在 iframe 中打开链接时如何使背景色变为绿色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37358589/

相关文章:

javascript - 魔术日历,日期与使用 JS/jQuery 的日期不匹配

html - 视口(viewport)元标记不起作用

html - 我如何显示三个 Div 和一个表格,使其紧挨着彼此

javascript - 使用 javascript(或 jQuery)选择和操作 CSS 伪元素,例如::before 和::after

javascript - 将选择标签的外观更改为单选按钮

javascript - 如何使用 jquery 选择表中一行的值?

html - 表格 TD 宽度不起作用

javascript - 我的 javascript 隐藏了所有的 div。

html - CSS3 子菜单未显示在焦点上

android - phonegap + jquery 移动 : css not working