【发布时间】:2010-11-15 17:08:26
【问题描述】:
我在 CSS 中的输入框上弄乱了 CSS,以使文本变大、添加边框、更改颜色等。
我已经使用填充将较大的文本对齐(垂直对齐)在我的输入框中,但是闪烁的小文本光标非常对齐(拥抱底部)。我想知道是否有一种方法可以自行调整闪烁的文本光标而不会弄乱文本的位置。
谢谢! 马特
这是 CSS:
div#search_box {
height:32px;
width: 366px;
float:left;
margin-left:86px;
margin-top:14px;
background-color: #ffffff;
border: 2px solid #b66b01;
}
input#search_input {
border:none;
position: relative;
float: left;
height: 32px;
width: 335px;
font-size: 18px;
padding-top: 9px;
padding-left: 4px;
outline-style:none;
font-family: Helvetica, Arial, "MS Trebuchet", sans-serif;
color: #5a5a5a;
}
div#search_icon {
width:22px;
height:24px;
float:right;
margin-right:5px;
margin-top:4px;
cursor: pointer;
background: url('images/magnifier.png');
}
HTML:
<div id="search_box">
<input type="text" name="query" id="search_input" autocomplete="off"/>
<div id="search_icon">
</div>
结果:
【问题讨论】:
-
向我们展示代码会很有帮助。另外,这是否会在不同的浏览器中发生?
-
嗯,它在其他浏览器中看起来不同,但它们看起来都不理想。这张图片来自火狐。
-
哦天哪.. Ummm... 无论未定义的 DOCTYPE 是什么?为什么这是相关的? (我对这些东西的经验很少。)
标签: javascript jquery html css input