目录
1.应用html标签和css完成如下所示页面效果,图片见附件。
1.应用html标签和css完成如下所示页面效果,图片见附件。
说明:
- 内容相对于浏览器居中,宽860px
- 鼠标移动至列表项上,显示背景色#F8F8F8
- 分割线2px solid #ccc,每项高130px
- 第一行文字:20px 黑体
- 标签:字颜色#cccc00 16px
- 标签项:背景颜色#eee 字体颜色#999 文字大小14px
- 第三行文字:边框1px solid #eee; 圆角半径25px
其他样式可根据界面效果进行设置
运行截图
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>第一题</title>
<style>
* {
margin: 0;
padding: 0;
}
.out {
width: 860px;
margin: auto;
top: 50%;
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
border: 1px solid #c5c5c5;
}
ul {
width: 860px;
}
li {
width: 860px;
height: 200px;
border-top: 4px solid rgb(186, 186, 186);
list-style: none;
}
li:hover {
background-color: #F8F8F8;
}
.toptext {
color: #666;
font-size: 14px;
line-height: 32px;
}
.sectext {
display: inline-block;
font-size: 12px;
font-weight: bold;
color: #ff5584;
line-height: 25px;
}
.sectext2 {
display: inline-block;
font-size: 12px;
color: #66669f;
line-height: 25px;
}
img {
width: 250px;
height: 188px;
}
.thrtext {
font-size: 12px;
color: #66669f;
line-height: 25px;
}
.context {
float: left;
margin-left: 0;
margin-top: 20px;
}
.context .text1 {
font-size: 20px;
margin-bottom: 30px;
}
.context .text2 div {
float: left;
margin-right: 10px;
}
.context .text2 {
margin-bottom: 30px;
height: 20px;
line-height: 20px;
}
.context .text3 div {
float: left;
margin-right: 20px;
}
.imgdiv {
display: inline-block;
margin: 20px 20px;
float: left;
}
.imgdiv img {
height: 150px;
}
.bq {
color: #cccc00;
font-size: 16px;
}
.bqx {
background-color: #eee;
color: #999;
padding: 2px;
font-size: 14px;
}
.border {
border: 1px solid #eee;
border-radius: 25px;
padding: 5px;
background-color: rgb(248, 248, 248);
}
</style>
</head>
<body>
<div class="out">
<ul>
<li>
<div class="imgdiv">
<img src="./images/4.jpg" alt="">
</div>
<div class="context">
<div class="text1">不只有看肤色挑唇色 选对口红衣服更美</div>
<div class="text2">
<div class="bq">标签</div>
<div class="bqx">唇膏</div>
<div class="bqx">衣服</div>
<div class="bqx">粉色</div>
<div class="bqx">化妆</div>
<div class="bqx">美容美体</div>
</div>
<div class="text3">
<div class="border">悦己self</div>
<div style="margin-top: 5px;">2016-10-18</div>
</div>
</div>
</li>
<li>
<div class="imgdiv">
<img src="./images/5.jpg" alt="">
</div>
<div class="context">
<div class="text1">学画红唇妆 让你的女王范分分钟秒杀路人</div>
<div class="text2">
<div class="bq">标签</div>
<div class="bqx">唇膏</div>
<div class="bqx">衣服</div>
<div class="bqx">粉色</div>
<div class="bqx">化妆</div>
<div class="bqx">美容美体</div>
</div>
<div class="text3">
<div class="border">毛戈平形象艺术学校</div>
<div style="margin-top: 5px;">2016-10-18</div>
</div>
</div>
</li>
<li>
<div class="imgdiv">
<img src="./images/6.jpg" alt="">
</div>
<div class="context">
<div class="text1">无数次给国外博主跪了 把自己的脸面画成漫画人物好逼真</div>
<div class="text2">
<div class="bq">标签</div>
<div class="bqx">美容美体</div>
</div>
<div class="text3">
<div class="border">八公举</div>
<div style="margin-top: 5px;">2016-10-18</div>
</div>
</div>
</li>
</ul>
</div>
</body>
</html>
2.完成如图所示界面布局和显示效果
运行截图:
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>第二题</title>
<style>
body {
height: 90%;
width: 90%;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
.title {
background-color: darkgrey;
padding-top: 10px;
padding-bottom: 10px;
border: 1px solid;
border-radius: 5px;
border-color: darkgrey;
display: block;
}
span {
text-decoration: underline;
margin-left: 85px;
font-size: 20px;
color: azure;
}
span:hover {
color: red;
}
.body {
margin-bottom: 300px;
}
.news {
margin-right: 100px;
display: inline-block;
}
p {
font-weight: bolder;
font-size: 30px;
}
li {
overflow: hidden;
margin-top: 20px;
margin-bottom: 20px;
font: 15px 黑体;
}
.context {
margin-right: 100px;
}
.date {
float: right;
}
.end {
position: fixed;
width: 80%;
text-align: center;
}
.a_end {
text-decoration: underline;
font: 15px 黑体;
}
</style>
</head>
<body>
<div class="title">
<span>首页</span> <span>新闻</span> <span>体育</span> <span>娱乐</span> <span>财经</span><span>科技</span> <span>手机</span>
<span>数码</span>
</div>
<div class="body">
<div class="news">
<p>
娱乐新闻
</p>
<ul>
<li>
<a class="context"> 香港11111111111</a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context">《碟中谍5》曝外景地花絮</a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 灾难发生后该不该禁播娱乐节目</a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 多部好莱坞大片登陆中国</a><a class="date">2018-10-1</a>
</li>
</ul>
</div>
<div class="news">
<p>
军事新闻
</p>
<ul>
<li>
<a class="context"> 201811111111111111111 </a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 2222222222222诫</a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 333333333333333333333岛网页</a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 4444444444444444444444444尽出</a><a class="date">2018-10-1</a>
</li>
</ul>
</div>
<div class="news">
<p>
数码新闻
</p>
<ul>
<li>
<a class="context"> 微软已在秘密测试Android版Edge浏览器 </a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 平板电脑五年走到市场拐点</a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 苹果邀请函解密 Hint有新释义</a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> IDF2018英特尔谷歌联手</a><a class="date">2018-10-1</a>
</li>
</ul>
</div>
<div class="news">
<p>
手机新闻
</p>
<ul>
<li>
<a class="context"> 超大运行内存手机推荐 </a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 国产旗舰手机盘点</a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 日西门子归来 首款智能机配置强跑分出色</a><a class="date">2018-10-1</a>
</li>
<li>
<a class="context"> 骗子植入手机木马的10大招术</a><a class="date">2018-10-1</a>
</li>
</ul>
</div>
</div>
<div class="end">
<a class="a_end">关于我们</a> <a class="a_end">联系我们</a>
</div>
</body>
</html>
3.完成如下表单界面设计,图片见附件。
- 表单宽248px,高220px,背景色#F5EAE8,上下内边距30px 左右内边距40px,边框1px solid #F5EAE8
- 输入框宽250px,高38px,边框1px solid #CCC,下外边距30px。文本缩进50px,便于显示前方图标。前方图标可考虑背景图片进行设置。
- 按钮宽255px,高44px,外边距上下25px,左右居中
- 合作网站区域宽330px 高145px,背景颜色#F5EAE8,上边框1px solid #ddd
- 内容居中显示
运行截图
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>第三题</title>
<style>
body{
background-color:cadetblue;
}
.out{
/* 居中 */
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.top{
width: 248px;
height:220px;
padding-top: 30px;
padding-bottom: 30px;
background-color: #F5EAE8;
padding-left: 40px;
padding-right: 40px;
border:1px solid #F5EAE8;
}
.bottom{
height:145px;
width:330px;
background-color: #F5EAE8;
border-top: 1px solid #ddd;
text-align: center;
padding-top: 10px;
}
.input1{
background-color: #F5EAE8;
width: 250px;
height: 38px;
border: 1px solid #ccc;
margin-bottom: 30px;
color: #ccc;
font-size: 15px;
background-image: url("./images/zhanghao.jpg");
background-repeat: no-repeat;
text-indent:50px;
background-position: left;
}
.input2{
background-color: #F5EAE8;
width: 250px;
height: 38px;
border: 1px solid #ccc;
margin-bottom: 30px;
color: #ccc;
font-size: 15px;
background-image: url("./images/mima.jpg");
background-repeat: no-repeat;
text-indent:50px;
background-position: left;
}
.in{
display: inline-block;
}
label{
font-size: 15px;
}
span{
font-size: 12px;
color:darkgrey;
}
button{
width: 255px;
height: 44px;
margin-top: 25px;
margin-bottom: 25px;
text-align: center;
background-image: url("./images/but.jpg");
}
</style>
</head>
<body>
<div class="out">
<div class="top">
<input class="input1" placeholder="用户名/邮箱地址/手机号" style="position:static;" >
<input class="input2" placeholder="填写密码" style="position:static;" >
<div class="in">
<input type="checkbox" ><label>记住密码</label>
<span>欢迎注册</span>
<span>忘记密码</span>
</div>
<div>
<button></button>
</div>
</div>
<div class="bottom">
<div class="in">
<a>合作账号登录:</a>
<img src="./images/weixin.png">
<img src="./images/qqlogin.png">
<img src="./images/taobao.png">
</div>
</div>
</div>
</body>
</html>