【发布时间】:2009-02-08 22:40:44
【问题描述】:
我的网站设计包含如下所示的文本输入字段:
Input Field http://img401.imageshack.us/img401/4453/picture1ts2.png
我想知道创建此输入字段的最佳解决方案是什么。
我的一个想法是始终在输入周围放置一个带有背景图像的 div,并在输入字段上禁用所有边框并以像素为单位指定宽度,例如:
<div class="borderedInput"><input type="text" /></div>
我试图劝阻他们不要使用这种格式,但他们不会气馁,所以看来我不得不这样做了。
这是最好的还是有其他方法?
--
试用:
我尝试了以下方法:
<style type="text/css">
input.custom {
background-color: #fff;
background:url(/images/input-bkg-w173.gif) no-repeat;
width:173px;
height:28px;
padding:8px 5px 4px 5px;
border:none;
font-size:10px;
}
</style>
<input type="text" class="custom" size="12" />
但在 IE (6 & 7) 中,当您输入的内容超过宽度时,它会执行以下操作:
Over Length http://img240.imageshack.us/img240/1417/picture2kp8.png
【问题讨论】:
-
我建议使用 CSS3 box-shadow:css3please.com/#box_shadow