应用css后难以点击进入文本框

时间:2014-04-03 17:20:10

标签: html css

这似乎是一件简单的事情,但我无法弄清楚造成它的原因。

更新:这是我复制问题的小提琴:http://jsfiddle.net/X374V/1/

我有一个简单的文本输入形式:

<input type="text" name="commentor" id="commentor"  />

风格:

#commentor {
    position:relative;
    float:left;
    margin-bottom:5px;
    height:25px;
    width:160px;
    border-style:solid;
    border-width:1px;
    border-color:#000;
    background-color:#CCC;
}

为了点击要输入的文本框,我必须单击框的最顶部边缘,单击中间的某个部分会丢失它。有没有办法纠正这个?

3 个答案:

答案 0 :(得分:2)

这应该解决它。你的div正在报道输入。

#commentorName {
    color: #33CCCC;
    display: inline;
    font-family: futuraCondensed;
    font-size: 20px;
    line-height: 1.5em;
    position: relative;
}

答案 1 :(得分:1)

这里有一个小小的工作。

我将评论员div更改为span

http://jsfiddle.net/X374V/3/

答案 2 :(得分:0)

在标签上添加margin-left:

#commentorName {
    position:relative;
    top:8px;
    font-family:futuraCondensed;
    font-size:20px;
    color:#33cccc;
    margin-left: 168px;
}

请参阅小提琴:http://jsfiddle.net/harveyramer/Zp9D3/