文本输入顶部和左侧边框显示错误

时间:2013-09-22 21:35:16

标签: html css css3

我有一个文字输入,但颜色在顶部和左侧边框上不正确,为什么会这样,我该如何解决?

http://jsfiddle.net/9ehBs/

HTML

<input type="text" class="searchbox" />

CSS

.searchbox
{
    width: 200px;
    height: 30px;
    padding: 10px;
    font-size: 28px;
    font-weight: 900;
    font-family: Ebrima;
    color: rgb(54,54,54);
    border-width: 13px;
    border-color: rgb(46,94,115);
    float: left;
    margin-left: 10px;
    margin-top: 10px;
}

3 个答案:

答案 0 :(得分:3)

您需要border-style: solidSee your updated fiddle.

使用shorthand,即border: 13px solid rgb(46,94,115);

会更有效率

答案 1 :(得分:1)

border: 13px solid rgb(46,94,115);

在一行中更容易......希望它有所帮助

答案 2 :(得分:0)

.searchbox
{
    width: 200px;
    height: 30px;
    padding: 10px;
    font-size: 28px;
    font-weight: 900;
    font-family: Ebrima;
    color: rgb(54,54,54);
    border-width: 13px;
    border-style: solid;/* add this to your css options: dotted | solid | dashed */
    border-color: rgb(46,94,115);
    float: left;
    margin-left: 10px;
    margin-top: 10px;
}

简写:

margin: 10px 0 0 10px; /*(top, right and left, bottom)*/
border:13px solid rgb(46,94,115);

...而不是

margin-left: 10px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;


border-width: 13px;
border-style: solid;/* add this to your css options: dotted | solid | dashed */
border-color: rgb(46,94,115);