html - CSS 按钮有边框

标签 html css button

我正在尝试为我的搜索表单定义一个自定义 CSS 按钮。我不明白为什么这个特定的按钮周围有一个奇怪的边框?我需要将其删除,但无法弄清楚它在 css..code 和下面的 fiddle 中的来源。

/* Define Search Button */
button.button-search::-moz-focus-inner { padding:0; border:0; } /* FF Fix */
button.button-search { -webkit-border-fit:lines; } /* <- Safari & Google Chrome Fix */
button.button-search { position:absolute; right:10px; top:8px; } 
button.button-search > span { 
    background: #3399CC; /* Old browsers */
    box-shadow:1px 1px 0 #a4a4a4; 
    display:block;
    float:none;
    width:88px; 
    height:32px; 
    line-height:30px; 
    text-align:center; 
    font-size:15px; 
    color:#fff;
    text-align:center !important;
}

button.button-search span span { padding:0; float:none; }

button.button-search:hover > span { 
    opacity:0.8 !important;filter:alpha(opacity=80) !important;
    box-shadow:1px 1px 0 #a4a4a4;
}

.header .form-search button.button-search { } 
.header .form-search button.button-search > span { }
.header .form-search button.button-search:hover > span { }
.header .form-search button.button-search span span { }
.header .form-search button.button-search:hover span {}

<div class="header">
  <div class="form-search">
      <button type="submit" title="<?php echo $this->__('Search') ?>" class="button-search"><span><span>Search</span></span></button>
  </div>
</div>

http://jsfiddle.net/fnysccad/

谢谢

最佳答案

您正在将 CSS 应用于按钮内的跨度,因此按钮的默认样式仍在使用:

摆脱所有凌乱<span> ,并且,正如@Christoph 在评论中所说,type="submit"可以省略,因为它是按钮的默认功能:

<div class="form-search">

<button title="<?php echo $this->__('Search') ?>" class="button-search">Search</button>
</div> 

将 CSS 应用于输入:

button.button-search::-moz-focus-inner { padding:0; border:0; } /* FF Fix */
button.button-search { -webkit-border-fit:lines; } /* <- Safari & Google Chrome Fix */
button.button-search { position:absolute; right:10px; top:8px; } 
button.button-search { 
    background: #3399CC; /* Old browsers */
    box-shadow:1px 1px 0 #a4a4a4; 
    display:block;
    float:none;
    width:88px; 
    height:32px; 
    line-height:30px; 
    text-align:center; 
    font-size:15px; 
    color:#fff;
    text-align:center !important;
    border:none;/*Removes the border*/
}

http://jsfiddle.net/q3t2srfg/1/

关于html - CSS 按钮有边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28221415/

相关文章:

jquery - 带有悬停的 IE 中的奇怪 CSS 问题

php - 在 html 中显示下拉列表中的值数据

html - 如何排除第n个选择器?

html - "chevron"CSS 和浏览器缩放问题中的样式导航栏

css - 如何将 CSS 样式应用于 Drupal 搜索表单提交按钮?

javascript - float 容器不会在内容收缩时收缩

javascript - 我们怎样才能使音频在所有浏览器中工作,如果浏览器不支持它,我们可以使用什么原语?

javascript - 单击顶部时关闭子菜单

android - 在 Android 应用程序中有一个 "back"按钮是否合理?

javascript - Tweet 按钮看起来像一个普通的 <a> 链接,没有任何 JS 或 CSS