如何在Ionic Framework中更改按钮颜色

时间:2015-08-10 11:48:20

标签: android html css ionic

单击时如何更改按钮颜色?我尝试了:主动样式,但它不能在Android设备上工作(但它确实在浏览器中工作)。

例如我有一个像这样的按钮

<button class="button button-full button-calm button-login" type="submit">Sign In</button>

和这样的风格

.login .button-login {
  width:96%;
  background: red;
  margin: 0 auto;
  border: 0;
  border-radius: 4px;
  moz-border-radius: 4px;
  webkit-border-radius: 4px;    
  transition: all 0.3s ease 0s;
}

.login .button-login:active {
  background: yellow;
}

我希望按钮在触摸时变黄,当用户抬起手指时变为红色。

2 个答案:

答案 0 :(得分:2)

我认为,好主意是用经过精心设计的<button>替换<a>

例如像这样。

&#13;
&#13;
#button {
    background-color: #E3E1B8; 
    padding: 2px 4px;
    font: 13px sans-serif;
    text-decoration: none;
    border: 1px solid #000;
    border-color: #aaa #444 #444 #aaa;
    color: #000
}

#button:hover { background-color: #46000D; }
&#13;
<a href="#" id="button">New Element</a>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

        I have done it using Ionic Way what he has done in own css.

 <button id="login2-button9" class="button button-gold">English</button>

在您的css文件中添加

      .button.button-gold {
            border-color: transparent;
            background-color: #625031;
            color: #000000; }
            .button.button-gold:hover {
              color: #000000;
              text-decoration: none; }
            .button.button-gold.active, .button.button-gold.activated {
              background-color:#c0a062; }
            .button.button-gold.button-clear {
              border-color: transparent;
              background: none;
              box-shadow: none;
              color: #625031; }
            .button.button-gold.button-icon {
              border-color: transparent;
              background: none; }
            .button.button-gold.button-outline {
              border-color: #625031;
              background: transparent;
              color: #625031; }
              .button.button-gold.button-outline.active, .button.button-gold.button-outline.activated {
                background-color: #625031;
                box-shadow: none;
                color: #000000; }