65.9K
CodeProject 正在变化。 阅读更多。
Home

CSS 乐趣 第二部分

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.26/5 (12投票s)

2005年6月13日

viewsIcon

30814

美化您的 <input /> 字段

Sample Image - fun_with_css_part_2.gif

引言

您有没有觉得默认的 <input /> 字段过于单调?为什么不为其添加背景图片呢?这对于登录表单或其他类似场景来说是个不错的想法。如果您喜欢这个主意,请创建以下 .css 样式表。

.inputfieldsPassword {
    background: url('../pictures/password.png') no-repeat 0 1px;
    background-color: white;
    padding-left: 17px;
    font-size: 8pt;
    font-family: Verdana;
    width: 100%;
    height: 19px;
    border: 1px solid #7b9ebd;
}

将 <input /> 控件的 class 属性设置为上面创建的 .css 类

<input name="txtPasswort" type="password" id="txtPasswort" class="inputfieldsPassword" />

再次说明,尽情享受吧 :-)

© . All rights reserved.