现在框架已经做好了,即下来我们要对页面进行装饰了,第一步给每一个元素添加id

1、最外面的div添加id为divMain

2、第二个div添加id为divTitle,里面的span对应的id为spanTitle

3、第三个div添加id为divBody,里面的table对应的id为tableForm

4、table里面对应的input 对应的id的名称就是其那么对应的名称

添加的id如下:

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册</title>
</head>
<body>
<div id="divMain">
<div id="divTitle"><span id="spanTitle">新用户注册</span></div>
<div id="divBoby"><table id="tableForm">
<tr>
<td>用户名:</td>
<td><input type="text" name ="loginname" id="loginname"/></td>
<td><label>用户名不能为空</label></td>
</tr> <tr>
<td>登陆密码:</td>
<td><input type="password" name ="loginpass" id="loginpass"/></td>
<td><label></label></td>
</tr> <tr>
<td>确认密码:</td>
<td><input type="password" name ="reloginrepass" id="reloginrepass"/></td>
<td><label></label></td>
</tr> <tr>
<td>Emain:</td>
<td><input type="password" name ="email" id="email"/></td>
<td><label></label></td>
</tr> <tr>
<td>图形验证码:</td>
<td><input type="text" name ="verifyCode" id="verifyCode"/></td>
<td><label></label></td>
</tr> <tr>
<td></td>
<td><img src=""></td>
<td><label><a href="">换一张</a></label></td>
</tr> <tr>
<td></td>
<td><input type="image" src="<c:url value='/images/regist1.jpg'/>" id="submitBtn"/></td>
<td><label></label></td>
</tr> </table></div>
</div>
</body>
</html>

接下来我们要创建一个regist.css

然后在html中引入该css

<link  rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/user/regist.css'/>">

我们来如何进行regist.css代码的编写:

我们先来看一个简单的列子:

<style type="text/css">
#container {
width: 80%;
height: 500px;
} .attr {
width: 50%;
height: 0;
padding-bottom: 50%;
background-color: #008b57;
}
</style> <div id='container'>
<div class='attr'></div>
</div>

这里是我们是使用id的方式

第一步首先给divTitle和divBody设置宽度和高度

#divTitle{width:880px;heigth:30px}
#divBody{width:880px;heigth:400px}

然后添加边框

#divTitle{width:880px;heigth:30px;border:1px solid #d0d0d0}
#divBoby{width:880px;heigth:400px;border:1px solid #d0d0d0}
border:1px solid #d0d0d0 1px表示线条宽度 solid是实心线条,
#d0d0d0表示线条的颜色
我们运行看下效果

我们会发现divTitle下方的边框和divBody上方的边框重合了变粗了

我们修改下样式,不设置divBody上面的边框

#divTitle{width:880px;heigth:30px;border:1px solid #d0d0d0}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}

接下来将整个注册页面的布局向中间移动我们需要给divMain添加外边距

#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:30px;border:1px solid #d0d0d0}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}

接下来我们设置spanTitle,外边18px,字体是粗体

#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:50px;border:1px solid #d0d0d0}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}
#spanTitle{margin-left: 18px;font-weight:}

接下来我们设置spanTitle背景图片,我们取一张图片的部分区域作为背景色

 
#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:50px;border:1px solid #d0d0d0;background: url(/goods/images/bg_btns.png)}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}
#spanTitle{margin-left: 18px;font-weight:;}
url(/goods/images/bg_btns.png)背景图片的位置

接下来设置表格

我们使用class来定义,为啥使用class不使用id了,表格中第一列是一个样式,第二列是一样样式,第三列是一个样式,每个样式有多个元素,多个元素具有相同的样式我们使用class比较好
我们先定义样式的id
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/user/regist.css'/>">
</head>
<body>
<div id="divMain">
<div id="divTitle"><span id="spanTitle">新用户注册</span></div>
<div id="divBoby"><table id="tableForm">
<tr>
<td class="tdText">用户名:</td>
<td class="tdInput"><input type="text" name ="loginname" id="loginname"/></td>
<td class="tdError"><label>用户名不能为空</label></td>
</tr> <tr>
<td class="tdText">登陆密码:</td>
<td class="tdInput"><input type="password" name ="loginpass" id="loginpass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">确认密码:</td>
<td class="tdInput"><input type="password" name ="reloginrepass" id="reloginrepass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">Emain:</td>
<td class="tdInput"><input type="password" name ="email" id="email"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">图形验证码:</td>
<td class="tdInput"><input type="text" name ="verifyCode" id="verifyCode"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><img src=""></td>
<td class="tdError"><label><a href="">换一张</a></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><input type="image" src="<c:url value='/images/regist1.jpg'/>" id="submitBtn"/></td>
<td class="tdError"><label></label></td>
</tr> </table></div>
</div>
</body>
</html>

即下来我们在css中设置class的样式

首先设置tableForm的行高为50px,边框为1px

#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:50px;border:1px solid #d0d0d0;background: url(/goods/images/bg_btns.png)}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}
#spanTitle{margin-left: 18px;font-weight:;}
#tableForm{line-height: 50px;border: 1px}
.tdText{width:300px }
.tdInput{width:250px }
.tdError{width:250px }

接下来让tdText右对齐

#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:50px;border:1px solid #d0d0d0;background: url(/goods/images/bg_btns.png)}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}
#spanTitle{margin-left: 18px;font-weight:;}
#tableForm{line-height: 50px;border: 1px}
.tdText{width:300px ;text-align: right;}
.tdInput{width:250px }
.tdError{width:250px }

我们运行看下样式

接下来设置input的宽度和高度

我们先给input添加class

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/user/regist.css'/>">
</head>
<body>
<div id="divMain">
<div id="divTitle"><span id="spanTitle">新用户注册</span></div>
<div id="divBoby"><table id="tableForm">
<tr>
<td class="tdText">用户名:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="loginname" id="loginname"/></td>
<td class="tdError"><label>用户名不能为空</label></td>
</tr> <tr>
<td class="tdText">登陆密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="loginpass" id="loginpass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">确认密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="reloginrepass" id="reloginrepass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">Emain:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="email" id="email"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">图形验证码:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="verifyCode" id="verifyCode"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><img src=""></td>
<td class="tdError"><label><a href="">换一张</a></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><input type="image" src="<c:url value='/images/regist1.jpg'/>" id="submitBtn"/></td>
<td class="tdError"><label></label></td>
</tr> </table></div>
</div>
</body>
</html>

我们编写css的样式:

#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:50px;border:1px solid #d0d0d0;background: url(/goods/images/bg_btns.png)}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}
#spanTitle{margin-left: 18px;font-weight:;}
#tableForm{line-height: 50px;border: 1px}
.tdText{width:300px ;text-align: right;}
.tdInput{width:250px }
.tdError{width:250px }
.inputClass{width: 240px;height: 32px;border: 1px solid #7f9db9;line-height: 32px}
width: 240px;height: 32px;border: 1px solid #7f9db9;line-height: 32px,其中width是宽度,heigth是高度,border是边框的厚度,边框是实心线,边框的颜色是
#7f9db9,line-height设置为和heigth的值一样是为了保证光标居中显示
我们运行看下效果

我们给光标添加下内边距

#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:50px;border:1px solid #d0d0d0;background: url(/goods/images/bg_btns.png)}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}
#spanTitle{margin-left: 18px;font-weight:;}
#tableForm{line-height: 50px;border: 1px}
.tdText{width:300px ;text-align: right;}
.tdInput{width:250px }
.tdError{width:250px }
.inputClass{width: 240px;height: 32px;border: 1px solid #7f9db9;line-height: 32px;padding-left: 10px}

我们再来看下运行的效果

接下来我们要让验证码的图片显示出来,请看

JavaWeb网上图书商城完整项目--验证码

显示在web.xml中配置servlet

<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<filter>
<filter-name>EncdoingFilter</filter-name>
<filter-class>cn.itcast.filter.EncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>EncdoingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>VerifyCodeServlet</servlet-name>
<servlet-class>cn.itcast.vcode.servlet.VerifyCodeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>VerifyCodeServlet</servlet-name>
<url-pattern>/VerifyCodeServlet</url-pattern>
</servlet-mapping>
</web-app>

接下来在regist.jsp中引入该servlet

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/user/regist.css'/>">
</head>
<body>
<div id="divMain">
<div id="divTitle"><span id="spanTitle">新用户注册</span></div>
<div id="divBoby"><table id="tableForm">
<tr>
<td class="tdText">用户名:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="loginname" id="loginname"/></td>
<td class="tdError"><label>用户名不能为空</label></td>
</tr> <tr>
<td class="tdText">登陆密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="loginpass" id="loginpass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">确认密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="reloginrepass" id="reloginrepass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">Emain:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="email" id="email"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">图形验证码:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="verifyCode" id="verifyCode"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><img src="<c:url value='/VerifyCodeServlet'/>"></td>
<td class="tdError"><label><a href="">换一张</a></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><input type="image" src="<c:url value='/images/regist1.jpg'/>" id="submitBtn"/></td>
<td class="tdError"><label></label></td>
</tr> </table></div>
</div>
</body>
</html>

我们运行看下效果

接下来我们给这个验证码图片增加样式

首先给验证码添加id

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/user/regist.css'/>">
</head>
<body>
<div id="divMain">
<div id="divTitle"><span id="spanTitle">新用户注册</span></div>
<div id="divBoby"><table id="tableForm">
<tr>
<td class="tdText">用户名:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="loginname" id="loginname"/></td>
<td class="tdError"><label>用户名不能为空</label></td>
</tr> <tr>
<td class="tdText">登陆密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="loginpass" id="loginpass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">确认密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="reloginrepass" id="reloginrepass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">Emain:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="email" id="email"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">图形验证码:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="verifyCode" id="verifyCode"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><img id="imgVerifyCode" src="<c:url value='/VerifyCodeServlet'/>"></td>
<td class="tdError"><label><a href="">换一张</a></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><input type="image" src="<c:url value='/images/regist1.jpg'/>" id="submitBtn"/></td>
<td class="tdError"><label></label></td>
</tr> </table></div>
</div>
</body>
</html>

我们在css中进行定义样式

将图片放大显示将宽度设置成100px

#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:50px;border:1px solid #d0d0d0;background: url(/goods/images/bg_btns.png)}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}
#spanTitle{margin-left: 18px;font-weight:;}
#tableForm{line-height: 50px;border: 1px}
.tdText{width:300px ;text-align: right;}
.tdInput{width:250px }
.tdError{width:250px }
.inputClass{width: 240px;height: 32px;border: 1px solid #7f9db9;line-height: 32px;padding-left: 10px}
#imgVerifyCode{width: 100px}

即下来我们需要验证码居中显示,我们先给包括图片的div添加id,然后再给其设置样式

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/user/regist.css'/>">
</head>
<body>
<div id="divMain">
<div id="divTitle"><span id="spanTitle">新用户注册</span></div>
<div id="divBoby"><table id="tableForm">
<tr>
<td class="tdText">用户名:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="loginname" id="loginname"/></td>
<td class="tdError"><label>用户名不能为空</label></td>
</tr> <tr>
<td class="tdText">登陆密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="loginpass" id="loginpass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">确认密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="reloginrepass" id="reloginrepass"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">Emain:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="email" id="email"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText">图形验证码:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="verifyCode" id="verifyCode"/></td>
<td class="tdError"><label></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><div id="divVerifyCode"><img id="imgVerifyCode" src="<c:url value='/VerifyCodeServlet'/>"></div></td>
<td class="tdError"><label><a href="">换一张</a></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><input type="image" src="<c:url value='/images/regist1.jpg'/>" id="submitBtn"/></td>
<td class="tdError"><label></label></td>
</tr> </table></div>
</div>
</body>
</html>

我们来看下css的代码

#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:50px;border:1px solid #d0d0d0;background: url(/goods/images/bg_btns.png)}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}
#spanTitle{margin-left: 18px;font-weight:;}
#tableForm{line-height: 50px;border: 1px}
.tdText{width:300px ;text-align: right;}
.tdInput{width:250px }
.tdError{width:250px }
.inputClass{width: 240px;height: 32px;border: 1px solid #7f9db9;line-height: 32px;padding-left: 10px}
#imgVerifyCode{width: 100px}
#divVerifyCode{text-align: center;border: 1px solid #e2e2e2;}
#divVerifyCode{text-align: center;border: 1px solid #e2e2e2;}其中
text-align: center让div中的内容居中,div中的内容是img验证码图片,这样验证码图片就居中中
;border: 1px solid #e2e2e2给验证码添加边框

运行的效果如下:

即下来我们设置用户名不能为空的样式,首先我们添加class和id


<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/user/regist.css'/>">
</head>
<body>
<div id="divMain">
<div id="divTitle"><span id="spanTitle">新用户注册</span></div>
<div id="divBoby"><table id="tableForm">
<tr>
<td class="tdText">用户名:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="loginname" id="loginname"/></td>
<td class="tdError"><label class="errorClass" id="loginnameError">用户名不能为空</label></td>
</tr> <tr>
<td class="tdText">登陆密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="loginpass" id="loginpass"/></td>
<td class="tdError"><label class="errorClass" id="loginpassError"></label></td>
</tr> <tr>
<td class="tdText">确认密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="reloginrepass" id="reloginrepass"/></td>
<td class="tdError"><label class="errorClass" id="reloginrepassError"></label></td>
</tr> <tr>
<td class="tdText">Email:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="email" id="email"/></td>
<td class="tdError"><label class="errorClass" id="emailError"></label></td>
</tr> <tr>
<td class="tdText">图形验证码:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="verifyCode" id="verifyCode"/></td>
<td class="tdError"><label class="errorClass" id="verifyCodeError"></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><div id="divVerifyCode"><img id="imgVerifyCode" src="<c:url value='/VerifyCodeServlet'/>"></div></td>
<td class="tdError"><label ><a href="">换一张</a></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><input type="image" src="<c:url value='/images/regist1.jpg'/>" id="submitBtn"/></td>
<td class="tdError"><label></label></td>
</tr> </table></div>
</div>
</body>
</html>

 
即下来在css中添加样式

#divMain{margin-left: 240px}
#divTitle{width:880px;heigth:50px;border:1px solid #d0d0d0;background: url(/goods/images/bg_btns.png)}
#divBoby{width:880px;heigth:400px;border-left:1px solid #d0d0d0;border-right: 1px solid #d0d0d0 ; border-bottom: 1px solid #d0d0d0}
#spanTitle{margin-left: 18px;font-weight:;}
#tableForm{line-height: 50px;border: 1px}
.tdText{width:300px ;text-align: right;}
.tdInput{width:250px }
.tdError{width:250px }
.inputClass{width: 240px;height: 32px;border: 1px solid #7f9db9;line-height: 32px;padding-left: 10px}
#imgVerifyCode{width: 100px}
#divVerifyCode{text-align: center;border: 1px solid #e2e2e2;}
.errorClass{color:#f40000;font-size: 10pt;border: 1px solid #ffb8b8;background-color: #fef2f2;
padding: 8px 8px 8px 35px;background: url(/goods/images/error.png) no-repeat;}

no-repeat表示背景图片有且仅仅显示一次背景图像将仅显示一次。

CSS里的 no-repeat是针对背景图片来说的。当你设置了no-repeat这个属性后,你的背景图片将不会被重复,再换一种说法,你在网站上所看到的背景图片就是你所添加的图片, 不会出现平铺或者重复的现象。

  你仍然可以通过其他方式来控制图片的位置

我们来看程序运行的效果:

整个regist.jsp的代码为:
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/user/regist.css'/>">
</head>
<body>
<div id="divMain">
<div id="divTitle"><span id="spanTitle">新用户注册</span></div>
<div id="divBoby"><table id="tableForm">
<tr>
<td class="tdText">用户名:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="loginname" id="loginname"/></td>
<td class="tdError"><label class="errorClass" id="loginnameError">用户名不能为空</label></td>
</tr> <tr>
<td class="tdText">登陆密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="loginpass" id="loginpass"/></td>
<td class="tdError"><label class="errorClass" id="loginpassError"></label></td>
</tr> <tr>
<td class="tdText">确认密码:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="reloginrepass" id="reloginrepass"/></td>
<td class="tdError"><label class="errorClass" id="reloginrepassError"></label></td>
</tr> <tr>
<td class="tdText">Email:</td>
<td class="tdInput"><input class="inputClass" type="password" name ="email" id="email"/></td>
<td class="tdError"><label class="errorClass" id="emailError"></label></td>
</tr> <tr>
<td class="tdText">图形验证码:</td>
<td class="tdInput"><input class="inputClass" type="text" name ="verifyCode" id="verifyCode"/></td>
<td class="tdError"><label class="errorClass" id="verifyCodeError"></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><div id="divVerifyCode"><img id="imgVerifyCode" src="<c:url value='/VerifyCodeServlet'/>"></div></td>
<td class="tdError"><label ><a href="">换一张</a></label></td>
</tr> <tr>
<td class="tdText"></td>
<td class="tdInput"><input type="image" src="<c:url value='/images/regist1.jpg'/>" id="submitBtn"/></td>
<td class="tdError"><label></label></td>
</tr> </table></div>
</div>
</body>
</html>
												

JavaWeb网上图书商城完整项目--24.注册页面的css样式实现的更多相关文章

  1. JavaWeb网上图书商城完整项目--23.注册页面之html实现

    我们来分析下这个页面的代码如何实现: 我们来分下下层次结构: 1.首先最外层是一个大的div,然后又包括两个小的div,第一个div中包括一个span,第二个div是一个table表 我们来看程序的代 ...

  2. JavaWeb网上图书商城完整项目--27.注册页面之注册按钮图片切换实现

    我们要实现立即注册这个按钮,光标获得焦点是一张图片,光标失去焦点的时候是另外一张图片 我们需要在文档加载完成之后,设置该事件hover事件 hover(over,out)这是jQuery的一个模仿悬停 ...

  3. JavaWeb网上图书商城完整项目--26.注册页面之验证码换一张实现

    我们现在要实现点击换一张的时候实现验证码的修改 我们首先在html添加函数点击事件: <%@ page language="java" contentType="t ...

  4. JavaWeb网上图书商城完整项目--25.注册页面之隐藏没有内容的错误信息实现

    在上一章中我们显示的效果如下所示: 上面后面都有错误的红色×的显示,这样是不对的,我们要解决该问题 我们要循环遍历每一个错误的信息,看它的内容有没有,如果有内容我们就显示错误的×,如果没有就不显示× ...

  5. JavaWeb网上图书商城完整项目--day02-4.regist页面提交表单时对所有输入框进行校验

    1.现在我们要将table表中的输入的参数全部提交到后台进行校验,我们提交我们是按照表单的形式提交,所以我们首先需要在table表外面添加一个表单 <%@ page language=" ...

  6. JavaWeb网上图书商城完整项目--day02-10.提交注册表单功能之页面实现

    1.当从服务器返回的注册错误信息的时候,我们在注册界面需要将错误信息显示出来 我们需要修改regist.jsp页面的代码:其中error是一个haspmap,c标签对map的属性可以直接使用 ${er ...

  7. JavaWeb网上图书商城完整项目--day02-9.提交注册表单功能之servlet层实现

    1.当用户在界面提交注册提交的时候,我们在UerServlet来实现具体的业务方法 标准demo: 1CommonUtils CommonUtils类就两个方法: lString uuid():生成长 ...

  8. JavaWeb网上图书商城完整项目--day02-8.提交注册表单功能之dao、service实现

    1.发送邮件 发送邮件的时候的参数我们都写在了配置文件中,配置文件放在src目录下,可以使用类加载器进行加载该数据 //向注册的用户发送邮件 //1读取配置文件 Properties properti ...

  9. JavaWeb网上图书商城完整项目--day02-7.提交注册表单功能之流程分析

    1.点击注册之后将提交的信息传递到UserServlet的public String regist方法进行处理,然后将东西通过service进行处理 业务流程:

随机推荐

  1. Postgre数据库自定义函数

    自定函数 1.查询函数: select prosrc from pg_proc where proname='test' 参数说明 : test 为函数名. 2.删除函数: drop function ...

  2. Python 每日一练(2)

    引言 我又双叒叕的来啦,新博客的第二篇文章,这次是继之前公众号上每日一练的第二个,这次是专题实对于文件的一些处理的练习 主要有以下几类: 1.实现英文文章字频统计 2.统一剪裁某一指定目录下的所有图片 ...

  3. python基本操作-文件、目录及路径

    目录 1 前言 2 文件夹操作 2.1 查询操作 2.2 创建操作 2.3 删除操作 2.4 修改操作 3 文件操作 3.1 查询操作 3.2 创建操作 3.3 修改操作 3.4 删除 4 路径操作 ...

  4. .net core 上传大文件

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Thr ...

  5. MethodHandle(方法句柄)系列之三:invoke和invokeExact的区别

    先把代码贴上来,用的是一样的代码 /** * * @author LiuYeFeng<897908343@qq.com> * @date 2015年4月8日 下午10:41:13 * @C ...

  6. SpringMVC(四)SpringMVC实现文件上传、异常拦截去、整合SSM

    个人博客网:https://wushaopei.github.io/    (你想要这里多有) 一.文件上传 文件上传在SpringMVC中如何实现: 准备一个文件上传的表单 导入文件上传需要的jar ...

  7. Java实现 LeetCode 806 写字符串需要的行数 (暴力模拟)

    806. 写字符串需要的行数 我们要把给定的字符串 S 从左到右写到每一行上,每一行的最大宽度为100个单位,如果我们在写某个字母的时候会使这行超过了100 个单位,那么我们应该把这个字母写到下一行. ...

  8. (Java实现)洛谷 P2095 营养膳食

    题目描述 Mr.L正在完成自己的增肥计划. 为了增肥,Mr.L希望吃到更多的脂肪.然而也不能只吃高脂肪食品,那样的话就会导致缺少其他营养.Mr.L通过研究发现:真正的营养膳食规定某类食品不宜一次性吃超 ...

  9. Java实现 LeetCode 532 数组中的K-diff数对(双指针,滑动窗口)

    532. 数组中的K-diff数对 给定一个整数数组和一个整数 k, 你需要在数组里找到不同的 k-diff 数对.这里将 k-diff 数对定义为一个整数对 (i, j), 其中 i 和 j 都是数 ...

  10. java实现金额组合

    某财务部门结账时发现总金额不对头.很可能是从明细上漏掉了某 1 笔或几笔. 如果已知明细账目清单,能通过编程找到漏掉的是哪 1 笔或几笔吗? 如果有多种可能,则输出所有可能的情况. 我们规定:用户输入 ...