【问题标题】:Class is not applying to submit button班级未申请提交按钮
【发布时间】:2010-06-09 16:29:34
【问题描述】:

我正在尝试将一个类应用于以下提交按钮 代码:

<input type="submit" value="Submit" name="commit" class="confirm-button-submit ">

css:

.confirm-button-submit 
{
   width    : 79px;
   font      : bold 12px sans-serif;;
   color    : #000;
   background    : url("../images/confirm-btn.png") 0 -33px no-repeat;
   text-decoration : none;
   margin-top    :0px;
   text-align:center;
   border:0px;
   cursor : pointer;
   height:170px;
}


.confirm-button-submit a
{
   width    : 79px;
   font      : bold 12px sans-serif;;
   color    : #000;
   background    : url("../images/confirm-btn.png") 0 -33px no-repeat;
   text-decoration : none;
   margin-top    :0px;
   text-align:center;
   border:0px;
   cursor : pointer;
   height:170px;
}



.confirm-button-submit a:hover
{
   width    : 79px;
   font      : bold 12px sans-serif;;
   color    : #000;
   background    : url("../images/confirm-btn.png") 0 0 no-repeat;
   text-decoration : none;
   margin-top    :0px;
   text-align:center;
   border:0px;
   cursor : pointer;
   height:170px;
}

但它不能正常工作该怎么做

谢谢

【问题讨论】:

  • 设置类名后,什么不能正常工作?

标签: html ruby-on-rails css


【解决方案1】:

我假设您打算应用 .confirm-button-submit 的 CSS 规则,但您的按钮没有该类。

你必须使用:

<input type="submit" value="Submit" name="commit" class="confirm-button-submit" />

【讨论】:

    【解决方案2】:

    您的代码没有类。

    <input type="submit" value="Submit" name="commit" class='confirm-button confirm-button-submit'>
    

    edit — 一组问题可能是您尝试设置 &lt;input type='submit'&gt; 元素不支持的 CSS 属性。我怀疑如果您在 Firebug DOM 检查器中查看 &lt;input&gt; 元素,您可能会看到所有 CSS 类,但您也会看到它们实际上没有任何效果。

    【讨论】:

      猜你喜欢
      • 2015-09-10
      • 2012-04-19
      • 2012-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多