通过css实现表单form的美化

更新时间:2023-09-05 23:23:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

通过css实现表单form的美化,文档里是个完整的Html页面源代码,下载后另存为html文件就可以看效果了。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.77cn.com.cn/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.77cn.com.cn/1999/xhtml">

<head>

<title>表单form的美化(包括input radio checkbox textarea submit select等一系列)</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<script language="javascript" type="text/javascript" src="1450_niceforms.js"></script> <style type="text/css">

* {

margin:0;

padding:0;

}

body {

font-family:Arial, Helvetica, sans-serif;

font-size:12px;

color:#404040;

background:#FFF;

}

img {

border:0;

}

#container {

padding:20px;

}

/*Forms defaults*/

input, textarea {

font-family:Arial, Helvetica, sans-serif;

font-size:12px;

color:#404040;

}

label {

color:#999;

cursor:pointer;

padding-left:2px;

line-height:15px;

vertical-align:top;

}

label.chosen {

color:#333;

}

/*Transparent items*/

通过css实现表单form的美化,文档里是个完整的Html页面源代码,下载后另存为html文件就可以看效果了。

.transparent {

filter:alpha(opacity=0);

-moz-opacity:0;

opacity: 0;

border:0px solid #FFF;

background:#FFF;

z-index:10;

cursor:pointer;

}

.transparentFake {

background:none;

border:none;

}

.transparent2 {

z-index:10;

}

/*Radio buttons*/

.radioAreaUnchecked, .radioAreaChecked {

z-index:5;

position:absolute;

width:15px;

height:15px;

cursor:pointer;

}

.radioAreaUnchecked {

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_radio.gif) no-repeat left top; }

.radioAreaChecked {

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_radio.gif) no-repeat left bottom; }

/*Checkboxes*/

.checkboxAreaUnchecked, .checkboxAreaChecked {

z-index:5;

position:absolute;

width:14px;

height:14px;

cursor:pointer;

}

.checkboxAreaUnchecked {

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_checkbox.gif) no-repeat left top;

}

通过css实现表单form的美化,文档里是个完整的Html页面源代码,下载后另存为html文件就可以看效果了。

.checkboxAreaChecked {

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_checkbox.gif) no-repeat left bottom;

}

/*Text inputs*/

.textinput, .textinputHovered {

width:236px;

height:15px;

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_input.gif) no-repeat left top; border:none;

padding:4px 8px;

}

.textinputHovered {

background-position:left bottom;

}

/*Text areas*/

.textarea, .textareaHovered {

width:336px;

height:125px;

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_textarea.gif) no-repeat left top; border:none;

padding:4px 8px;

}

.textareaHovered {

background-position:left bottom;

}

/*Selects*/

.selectArea {

width:200px;

height:21px;

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_select_bg.gif) repeat-x left top; }

.selectArea .left {

width:8px;

height:21px;

float:left;

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_select_left.gif) no-repeat left top;

}

.selectArea .right {

width:21px;

通过css实现表单form的美化,文档里是个完整的Html页面源代码,下载后另存为html文件就可以看效果了。

height:21px;

float:right;

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_select_right.gif) no-repeat left top;

}

.selectArea .right a {

display:block;

width:21px;

height:21px;

}

.selectArea .right i {

display:none;

}

.selectArea .center {

width:160px;

margin-left:5px;

margin-right:20px;

color:#FFF;

padding-top:3px;

}

/*Selects drop-down*/

.optionsDivInvisible, .optionsDivVisible {

position:absolute;

margin-top:-1px;

margin-left:3px;

width:172px;

background:#6f7074;

padding:2px;

font-size:11px;

z-index:20;

}

.optionsDivInvisible {

display:none;

}

.optionsDivVisible {

display:block;

}

.optionsDivVisible p {

margin:0;

padding:0;

}

.optionsDivVisible a {

color:#F2F2F2;

通过css实现表单form的美化,文档里是个完整的Html页面源代码,下载后另存为html文件就可以看效果了。

text-decoration:none;

display:block;

padding:1px 4px;

border:1px solid #6f7074;

}

.optionsDivVisible a:hover {

color:#FFF;

background:#5F6062;

border-color:#cfd0d6;

}

/*Button*/

.buttonSubmit, .buttonSubmitHovered {

width:69px;

height:26px;

color:#FFF;

font-weight:bold;

padding:2px 5px;

background:url(http://www.77cn.com.cn/upload/2007/8/3/1450_button.gif) no-repeat left top; cursor:pointer;

border:none;

}

.buttonSubmitHovered {

background-position:left bottom;

}

/*Test div - testing if stylesheets are enabled*/

#stylesheetTest {

position:absolute;

left:-999px;

width:10px;

height:10px;

}

</style>

</head>

<body>

<div id="container">

<form action="vars.php" method="post">

<select size="1" id="mySelect1" name="mySelect1">

<option selected="selected" value="Test area no.1">Test area no.1</option> <option value="Another test option">Another test option</option>

<option value="And another one">And another one</option>

<option value="One last option for me">One last option for me</option>

通过css实现表单form的美化,文档里是个完整的Html页面源代码,下载后另存为html文件就可以看效果了。

</select>

<br />

<select size="1" id="mySelect2" name="mySelect2">

<option selected="selected" value="Test area no.2">Test area no.2</option> <option value="Another test">Another test</option>

<option value="And another one">And another one</option>

<option value="And yet another one">And yet another one</option>

<option value="One last option for me">One last option for me</option>

</select>

<br />

<input type="radio" name="radioSet" id="option1" value="foo" /><label for="option1">foo</label><br />

<input type="radio" name="radioSet" id="option2" value="bar" /><label for="option2">bar</label><br />

<input type="radio" name="radioSet" id="option3" value="another option" /><label for="option3">another option</label><br />

<br />

<input type="checkbox" name="checkSet1" id="check1" value="foo" /><label for="check1">foo</label><br />

<input type="checkbox" name="checkSet2" id="check2" value="bar" /><label for="check2">bar</label><br />

<input type="checkbox" name="checkSet3" id="check3" value="another option" /><label for="check3">another option</label><br />

<br />

<label for="textinput">Username:</label><br />

<input type="text" id="textinput" name="textinput" class="textinput" maxlength="25" /><br />

<label for="passwordinput">Password:</label><br />

<input type="password" id="passwordinput" name="passwordinput" class="textinput" maxlength="25" /><br />

<br />

<label for="textareainput">Comments:</label><br />

<textarea id="textareainput" name="textareainput" class="textarea"></textarea><br /> <br />

<input type="submit" value="Submit" class="buttonSubmit" />

<div id="stylesheetTest"></div>

</form>

<p>&nbsp;</p>

<p>Niceforms v.0.9<br>&copy;Lucian Slatineanu - <a href="http://www.77cn.com.cn">http://www.77cn.com.cn</a></p>

<p>Feel free to use and modify but please provide credits.</p>

</div>

</body>

</html>

本文来源:https://www.bwwdw.com/article/3jui.html

Top