【发布时间】:2011-01-15 22:01:37
【问题描述】:
我正在尝试制作一个简单的表单输入字段,在右上角的字段内有一个图像,该图像用作提交按钮。这是我的演示http://jsfiddle.net/BSXsY/ 我想要输入字段内的图像类(.button)。感谢您的帮助。
【问题讨论】:
我正在尝试制作一个简单的表单输入字段,在右上角的字段内有一个图像,该图像用作提交按钮。这是我的演示http://jsfiddle.net/BSXsY/ 我想要输入字段内的图像类(.button)。感谢您的帮助。
【问题讨论】:
要在输入字段中放置 astrik,您需要添加类。
代码如下:
<input type="text" class="astrik"/>
类的相应 CSS:
.astrik
{
background-image: url('../images/red_asterik.png');
height: 100%;
width: 100%;
background-repeat: no-repeat;
background-position: right;
background-position-x: 98%;
}
【讨论】:
通过改变两件事,我很确定我已经完成了你所要求的:
.searchinput {
color: #666666;
font-size: 13px;
padding-left: 2px;
top: 5px;
width: 200px;
/* Additions (or rather copies) */
background: url("http://img696.imageshack.us/img696/8137/13133747.jpg") right no-repeat;
height: 25px;
}
注意高度已更改以适应图像,可能需要调整文本大小/对齐方式。
【讨论】: