5

可能重复:
为什么我无法删除 Twitter Bootstrap 中的蓝色文本区域边框?

我为摆脱输入字段上的突出显示而进行的每次搜索都说要使用 css:

input:focus {
    outline:none;
}

这根本行不通。我正在使用最新版本的 chrome、firefox 和 safari 进行测试。

我也在使用 Bootstrap css 库,我不确定这是否会导致这种问题。

我想要达到的效果是模拟控制台屏幕中的空白行。我让它工作得很好,看起来很完美,除了当输入输出字段处于焦点时的突出显示。

任何帮助将不胜感激。

4

4 回答 4

10

对我有用的解决方案

input, input:focus{
        position:absolute;
        width:auto;
        bottom:0px;
        padding:0px;
        margin:2px;
        background-color:#000000;
        color:#33FF00;
        border-width: 0px;
        outline:0; /* I have also tried outline:none */
        -webkit-appearance:none;
        box-shadow: none;
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
}

特别是解决问题的基本CSS:

input, input:focus{
        border-width: 0px;
        outline:0; /* I have also tried outline:none */
        -webkit-appearance:none;
        box-shadow: none;
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
}

我最初忘记将 box-shadow 设置为 none。

于 2012-06-24T04:55:01.040 回答
7

如果input{outline:none;}不起作用,请尝试:

input, input:focus{
  outline:0px !important;
  -webkit-appearance:none;
}
于 2012-06-23T22:29:30.123 回答
4

不要将它附加到:focus伪事件。

input
{
    outline:none;
}
于 2012-06-23T22:09:20.193 回答
0

试试这样:

input {
    outline:none;
}

在我的网站上为我工作。如果它对您不起作用,请尝试提供小提琴。

于 2012-06-23T22:08:43.033 回答