尝试对类的链接进行样式设置

问题描述 投票:0回答:2

我的网站上大约有100个按钮,全部使用JavaScript onclick方法。我想将它们全部替换为用于SEO的常规<a href>链接。

我创建了一个名为button_seo的新类,它的CSS与旧按钮相同。我将其放置在全局CSS文件中,但无法使用,并且按钮没有样式。

[当我将CSS放在按钮所在的同一个文件中时,它确实起作用,但是我想将其放置在全局文件中,以便可以一次控制多个按钮。

什么原因造成的?我在文件中的任何地方都没有button_seo类的任何样式,只是在全局CSS文件中。

这是我的代码:

    .button_seo {
      height: 40px ;
      background: linear-gradient(to bottom, #4eb5e5 0%, #389ed5 100%); /* W3C */
      border: none;
      border-radius: 5px;
      position: relative;
      border-bottom: 4px solid #2b8bc6;
      color: #fbfbfb;
      font-weight: 600;
      font-family: "Open Sans", sans-serif;
      text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);
      font-size: 15px;
      text-align: center;
      text-indent: 5px;
      box-shadow: 0px 3px 0px 0px rgba(0, 0, 0, 0.2);
      cursor: pointer;
      width: 190px;
      left: 100px;
    }
<a class="button_seo" style="left:30px;" href='../censord' title='censord'>Click >></a>
css
2个回答
0
投票

作为对您的答案的评论,这是您想要的吗?

.button_seo {
display: inline-block;
line-height: 40px; /* same as height */
  height: 40px ;
  background: linear-gradient(to bottom, #4eb5e5 0%, #389ed5 100%); /* W3C */
  border: none;
  border-radius: 5px;
  position: relative;
  border-bottom: 4px solid #2b8bc6;
  color: #fbfbfb;
  font-weight: 600;
  font-family: "Open Sans", sans-serif;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);
  font-size: 15px;
  text-align: center;
  text-indent: 5px;
  box-shadow: 0px 3px 0px 0px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  width: 190px;
  left: 100px;
}
 <a class="button_seo" style="left:30px;" href='../censord' title='censord'>Click >></a>

编辑-我找到了this,所以


-1
投票

我已修复它,不能使用高度和宽度参数进行链接,毕竟不能使用按钮。

© www.soinside.com 2019 - 2024. All rights reserved.