题一:
实现代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>DIV+CSS布局</title>
<style>
#container{
width: 980px;
margin: 0px auto;
}
#header{
height: 136px;
background-color: #ccc;
}
#main{
height: 400px;
background-color: blueviolet;
}
#footer{
height: 100px;
background-color: #ccc;
}
</style>
</head>
<body>
<div id="container">
<div id="header">
顶部(header)
</div>
<div id="main">
主体
</div>
<div id="footer">
底部(footer)
</div>
</div>
</body>
</html>
实现效果:
题二:
实现代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.textBorder{
border-style: solid;
}
</style>
</head>
<body>
<div>
<form>
<table>
<tr>
<td colspan="2" style="text-align: center;"><h1>注册页</h1></td>
</tr>
<tr>
<td>姓名:</td>
<td>
<input type="text" name="username" size="40" class="textBorder" />
</td>
</tr>
<tr>
<td>密码:</td>
<td>
<input type="password" name="password" size="40" class="textBorder" />
</td>
</tr>
<tr>
<td>性别:</td>
<td>
<input type="radio" name="sex" value="男" checked="checked" />男
<input type="radio" name="sex" value="女" />女
</td>
</tr>
<tr>
<td>照片:</td>
<td>
<input type="file" name="files" />
</td>
</tr>
<tr>
<td>爱好:</td>
<td>
<input type="checkbox" name="check" value="书" checked="checked" />书
<input type="checkbox" name="check" value="运动" />运动
<input type="checkbox" name="check" value="聊天" />聊天
</td>
</tr>
<tr>
<td>所在城市:</td>
<td>
<select name="city">
<option value="" selected="selected">请选择</option>
<option value="1">北京</option>
<option value="2">上海</option>
<option value="3">广州</option>
<option value="4">成都</option>
<option value="5">重庆</option>
<option value="6">西安</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">协议:</td>
</tr>
<tr>
<td colspan="2">
<textarea name="agreement" cols="40" rows="4" readonly="readonly" class="textBorder" >请遵守相关规定,互相尊重,营造良好氛围。</textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;">
<input type="checkbox" name="check1" />我认真阅读并接受以上协议。
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;">
<input type="submit" name="refer" value="提交" disabled="disabled" />
<input type="submit" value="重置" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
实现效果:
题三:
实现代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>实现中间布局</title>
<style>
#container{
width: 980px;
margin: 0px auto;
}
#header{
height: 136px;
background-color: #ccc;
}
#main{
height: 400px;
background-color: bisque;
}
#footer{
height: 100px;
background-color: #ccc;
}
#left{
width: 50%;
height: 100%;
background-color: chartreuse;
float: left;
}
#right{
width: 50%;
height: 100%;
background-color: black;
float: left;
}
</style>
</head>
<body>
<div id="container">
<div id="header">
顶部(header)
</div>
<div id="main">
<div id="left">
登录(login)
</div id="right">
<div>
登录说明(login_right)
</div>
</div>
<div id="footer">
底部(footer)
</div>
</div>
</body>
</html>
实现效果:
题四:
实现代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
#container{
width: 1000px;
height:130px ;
margin: 0px auto;
background-image: url(img/h_bg.jpg);
}
#topmenu{
margin: 0px;
padding-top: 0px;
width: 480px;
height: 39px;
float: right;
}
#firstmenu{
padding: 0px;
margin: 0px;
width: 580px;
height: 33px;
float: right;
}
#logo{
width: 280px;
height: 96px;
}
#secondmenu{
margin-right: 550px;
padding-top: 15px;
width: 1000px;
height: 34px;
line-height: 34px;
clear: both;
}
.one{
background-image: url(img/icon.gif);
background-repeat: no-repeat;
background-position: 0px 0px;
width: 25px;
height: 22px;
}
.two{
background-image: url(img/icon.gif);
background-repeat: no-repeat;
background-position: -28px 0px;
width: 25px;
height: 22px;
}
.three{
background-image: url(img/icon.gif);
background-repeat: no-repeat;
background-position: -55px 0px;
width: 25px;
height: 22px;
}
.four{
background-image: url(img/icon.gif);
background-repeat: no-repeat;
background-position: -83px 0px;
width: 25px;
height: 22px;
}
.five{
background-image: url(img/icon.gif);
background-repeat: no-repeat;
background-position: 0px -25px;
width: 43px;
height: 22px;
}
li{
list-style: none;
margin: 0px;
float: left;
font-size: 12px;
height: 25px;
line-height: 25px;
width: 50px;
padding: 0px;
text-align: center;
}
.text{
list-style: none;
letter-spacing: 5px;
margin-top: 40px;
width: 450px;
height: 33px;
line-height: 33px;
font-size: 12px;
}
.text2{
width: 80px;
float: left;
}
#main{
width: 100%;
height: 400px;
background-color: #FF7300;
}
#footer{
width: 100%;
height: 100px;
background-color: yellow;
}
#left{
width: 50%;
height: 100%;
background-color: antiquewhite;
float: left;
}
#right{
width: 50%;
height: 100%;
background-color: red;
float: left;
}
</style>
</head>
<body>
<div id="container">
<div id="topmenu">
<ul>
<li class="one"></li>
<li>购物车</li>
<li class="two"></li>
<li>帮助中心</li>
<li class="three"></li>
<li>加入收藏</li>
<li class="four"></li>
<li>设为首页</li>
<li class="five">登录</li>
<li class="five">注册</li>
</ul>
</div>
<div id="firstmenu" class="text">
你好,贵美商城欢迎你!(hello)
</div>
<div id="secondmenu">
<ul>
<li class="text2">首 页</li>
<li class="text2">家用电器</li>
<li class="text2">手机数码</li>
<li class="text2">日用百货</li>
<li class="text2">书 籍</li>
<li class="text2">帮助中心</li>
<li class="text2">免费开店</li>
<li class="text2">全球资讯</li>
</ul>
</div>
<div id="main">
<div id="left">
左边
</div>
<div id="right">
右边
</div>
</div>
<div id="footer">
底部
</div>
</div>
</body>
</html>
实现效果:
题五:
实现代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<link rel="stylesheet" href="css/example06.css" type="text/css" />
<body>
<div id="div">
<ul>
<li>首 页</li>
<li>家用电器</li>
<li>手机数码</li>
<li><a href="">日用百货</a></li>
<li>书 籍</li>
<li>帮助中心</li>
<li>免费开店</li>
<li>全球资讯</li>
</ul>
</div>
</body>
</html>
css:
#div{
margin: 0px auto;
padding-top: 0px;
background-image: url(../img/picture.png);
width: 1000px;
height: 24px;
background-repeat: no-repeat;
}
li{
padding-top: 8px;
font-size: 10px;
list-style: none;
float: left;
width: 68px;
}
ul{
margin: 0px;
padding: 0px 10px;
}
a:hover{
background-image: url(../img/picture.png);
font-size: 32px;
text-decoration: none;
}
实现效果:
题六:
实现代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
#div{
margin: 0px auto;
padding-top: 40px;
width: 250px;
height: 272px;
background-image: url(img/bg.gif);
background-repeat: no-repeat;
}
dl{
margin: 0px;
padding: 0px;
}
dt{
margin: 0px;
padding-left: 5px;
float: left;
height: 60px;
width: 55px;
}
dd{
margin: 0px;
padding: 0px;
float: left;
height: 60px;
line-height: 40px;
}
</style>
</head>
<body>
<div id="div">
<dl>
<dt><img src="img/show1.jpg"</dt>
<dd>大牌狂降价,三折直送</dd>
</dl>
<dl>
<dt><img src="img/show2.jpg"</dt>
<dd>大学要求老师开网店</dd>
</dl>
<dl>
<dt><img src="img/show4.jpg"</dt>
<dd>黑眼圈推荐,美白不停</dd>
</dl>
<dl>
<dt><img src="img/show5.jpg"</dt>
<dd>瘦身狂潮风,修形之选</dd>
</dl>
</div>
</body>
</html>
实现效果:
以上均为个人所写,如有错误,欢迎指正,谢谢!