CSS2-10作业
<!DOCTYPE html>
<html>
<head>
<title>css assignment</title>
<style type="text/css">
*{padding:0;margin:0;}
/*头部的CSS样式*/
.header{ width:100%;
height:90px;
position: fixed;
top: 0;
left: 0;
z-index: 999;
background:#07cbc9;}
.header img{height:70px;
width:300px;
float:left;
padding-left:50px;
padding-top: 8px;}
/*导航的文字CSS样式*/
.header .daohang ul{padding-right:50px;
font-weight: bold;
font-variant: small-caps;}
.header .daohang ul li{float:right;
list-style: none;
color:#ffffff;
cursor: pointer;
font-size:1.5em;
margin:0 20px;
height:100px;
line-height: 100px;}
.header .daohang li:hover {background: #333;
height: 90px;}
/*banner的CSS样式*/
.bannerphoto{width: 100%;
height: 600px;
margin-top: 90px;/*装着banner图片的盒子紧贴header*/
position: relative;}
.banner img{width: 100%;
height: 600px;
position: relative;}
/*遮罩层的CSS样式*/
.cover{height:600px;
position:absolute;
top:90px;
width: 100%;
opacity: 0.5;
left:0;
background: #000;}
/*装着输入的盒子的CSS样式*/
/*相对于banner图居中*/
.banner .shuru {width: 500px;
height: 350px;
position: absolute;
/*background-color:black;*/
top: 390px;
left:50%;
margin-top: -175px;
margin-left: -250px;}
/*输入表单的CSS样式*/
/*令表单相对于shuru居中*/
.banner .shuru input{ width: 300px;
height: 20px;
background-color: none;
margin-top: 20px;
margin-left: 100px;/*(500-300)/2*/
color: white;
background:rgba(0,0,0,0.5);
font-size: 5px;
font-family: "微软雅黑";}
.banner .shuru .writecomment input {width: 300px;
height: 100px;
background-color: none;
color: white;
background:rgba(0,0,0,0.5);
font-size: 5px;
font-family: "微软雅黑";}
.banner .shuru input[type="Buttom"]{width: 100px;
margin-left: 200px;/*(500-100)/2*/}
.about{width: 100%;
position: relative;}
.about .abouthight{width: 100%;
position: relative;}
.about .abouthight .title{width: 600px;
position: absolute;
height: 100px;
top: 120px;
margin-top: -50px;
right: 50%;
margin-right: -300px;
text-align: center;}
.about .abouthight .title .middle img{padding: 10px 0;
width: 600px;
height: 300px;}
.about .aboutdown{width: 400px;
position: relative;}
.about .aboutdown .aboutus{position: absolute;
font-size: 16px;
width: 100px;
font-weight: bolder;
left: 450px;
top: 200px;}
.about .aboutdown .text{position: absolute;
width: 300px;
height: 170px;
left: 450px;
top:240px;
padding: 10px 0;
background: rgba(255,255,255,.3);
border: 1px #ccc solid;
z-index: 9;}
.about .aboutdown .right{width: 200px;
height: 150px;
position: absolute;
left: 1280px;
top: 200px;
z-index: 99;}
.about .aboutdown .right .upup,.lowlow{width: 200px;
height:100px;
text-align: center;
vertical-align: middle;
display: table;
border: 1px #07cbc9 solid;
margin: 20px 0;}
.about .aboutlow {position: absolute;
top: 600px;
width: 100%;
height: 500px;}
.about .aboutlow .texttext{float: left;
width: 475.75px;
height: 300px;
background:#07cbc9;}
.about .aboutlow img{float: left;
width: 475.75px;
height: 300px;}
hr{background:#07cbc9;
height: 2px;
width: 30px;
margin:5px auto;}
button{width: 100px;
height: 50px;
color: #ffffff;
font-size: 10px;
border: 0;
background-color: #000;}
.gallery{width:100%;
height: 600px;
background: #fff;
position: relative;
top:1300px;}
.gallery .gallery-top{margin: 10px auto;}
.gallery .gallery-top .word{font-size: 1.5em;
font-weight: bold;
text-align: center;}
.gallery .gallery-top .text1{ text-align: center;
width:400px;
margin: 10px auto; }
.gallery-bottom{width: 1300px;
margin: 10px auto;}
.gallery-bottom .gallery-bottom-item{margin: 20px;
float: left;
position: relative;}
.gallery-bottom .gallery-bottom-item .gallery-bottom-top{position: relative;
bottom: 20px;
height: 30px;
line-height: 30px;
color:#ffffff;
background-color: #000;}
/*footer部分*/
.footer{width: 100%;
height: 50px;
text-align: center;
line-height: 50px;
color: #ffffff;
z-index: 999;
position: fixed;
bottom: 0;
background-color:#07cbc9;}
</style>
</head>
<body>
<!--页面头部-->
<div class="header">
<img src="images/logo.png"/>
<div class="daohang">
<ul>
<li>home</li>
<li>about</li>
<li>gallery</li>
<li>faculity</li>
<li>event</li>
<li>contact</li>
</ul>
</div>
</div>
<!--banner-->
<div class="banner">
<!--banner图片部分-->
<div class="bannerphoto">
<img src="images/banner3.jpg"/>
</div>
<!--banner图片的遮罩层-->
<div class="cover"></div>
<!--banner区的输入表单-->
<div class="shuru">
<form>
<table>
<tr>
<td><input type="text" name="user name" size=25 placeholder="your Name"></td>
</tr>
<tr>
<td><input type="text" name="home place" size=25 placeholder="your Home"></td>
</tr>
<tr>
<td><input type="text" name="user email" size=25 placeholder="your Email"></td>
</tr>
<tr>
<td class="writecomment"><input type="text" name="user comment" size=25 placeholder="Write Your Comment Here"></td>
</tr>
<tr>
<td><input type="Buttom" name="send" size="10" placeholder="SEND MESSAGE"></td>
</tr>
</table>
</form>
</div>
</div>
<!--about-->
<div class="about">
<div class="abouthight">
<div class="title">
<h2 class="about-title">ABOUT</h2>
<hr/>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
<div class="middle">
<img src="images/bb3.jpg"/>
</div>
</div>
<div class="aboutdown">
<p class="aboutus">A WORD ABOUT US</p>
<div class="text">
<div class="left">
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
<button>EXPLORE</button>
</div>
</div>
<div class="right">
<div class="upup">
<p>7000</p>
<hr/>
<p class="downdown">students</p>
</div>
<div class="lowlow">
<p>6000</p>
<hr/>
<p class="downdown">Faculty</p>
</div>
</div>
</div>
</div>
<div class="aboutlow">
<div class="pic">
<img src="images/b1.jpg"/>
</div>
<div class="texttext">
<h2>Library</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unkonw printer tool a galley of type and scrambled it to make a type specimen book.</p>
<button>EXPLOER</button>
</div>
<div class="pic">
<img src="images/b2.jpg"/>
</div>
<div class="texttext">
<h2>Computer Lab</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unkonw printer tool a galley of type and scrambled it to make a type specimen book.</p>
<button>EXPLOER</button>
</div>
<div class="texttext">
<h2>Conference Hall</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unkonw printer tool a galley of type and scrambled it to make a type specimen book.</p>
<button>EXPLOER</button>
</div>
<div class="pic">
<img src="images/b3.jpg"/>
</div>
<div class="texttext">
<h2>Play Ground</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unkonw printer tool a galley of type and scrambled it to make a type specimen book.</p>
<button>EXPLOER</button>
</div>
<div class="pic">
<img src="images/b4.jpg"/>
</div>
</div>
</div>
<!--GALLERY部分-->
<div class="gallery">
<div class="gallery-top">
<div class="word">Gallery</div>
<hr/>
<div class="text1">Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.</div>
</div>
<div class="gallery-bottom">
<div class="gallery-bottom-item">
<div class="gallery-pic pic1"><img src="images/03-01.jpg" alt="pic"></div>
<div class="gallery-bottom-top"> SCIENCE LAB</div>
</div>
<div class="gallery-bottom-item">
<div class="gallery-pic pic2"><img src="images/03-02.jpg" alt="pic"></div>
<div class="gallery-bottom-top"> INDOOR STADIUM</div>
</div>
<div class="gallery-bottom-item">
<div class="gallery-pic pic3"><img src="images/03-03.jpg" alt="pic"></div>
<div class="gallery-bottom-top"> TRANSPORTATION</div>
</div>
<div class="gallery-bottom-item">
<div class="gallery-pic pic4"><img src="images/03-04.jpg" alt="pic"></div>
<div class="gallery-bottom-top"> KIDS ROOM</div>
</div>
<div class="gallery-bottom-item">
<div class="gallery-pic pic5"><img src="images/03-05.jpg" alt="pic"></div>
<div class="gallery-bottom-top"> MEDITATION CLASSES</div>
</div>
<div class="gallery-bottom-item">
<div class="gallery-pic pic6"><img src="images/03-06.jpg" alt="pic"></div>
<div class="gallery-bottom-top"> KIDS PLAYGROUND</div>
</div>
</div>
</div>
<div class="footer">
<p>© 2016 immoc.com 京ICP备13046642号</p>
</div>
</body>
</html>
在about区的右手边的7000 6000的部分文字如何垂直居中,加上display:table-cell之后两个框并列了
about的图片区如何设置width才能平铺整个界面,我的width是一个一个尝试出来的
为什么我的footer部分如果不加上fixed bottom:0就不能显示?
每个部分的位置应该如何确定top的值?如about部分,about的上半部分的top值是我一直尝试不同数值才调整出来的。
正在回答 回答被采纳积分+1
问题1、2、4都属于思路问题,我给你一些思路参考:
【about区】
设置一个大的div,然后设置这个div居中,注意这里的宽度要和GALLERY区的宽度一致,建议设置为1000px左右,里面3个小的div,设置浮动使显示在一行。
最后在设置一个div容纳遮罩的这部分,并使用绝对定位,要相对于上面说到的大div。
具体该填充多少值可以参考原型图。
2、以下区域
实现思路:
一个大的div容器,里面写八个小的div,分别容纳图片和内容,分别给8个不同的div设置左浮动,这样就能横向显示,并且每个div的宽度设置为25%,这样正好一排显示4个。注意里面字体的大小和颜色的设置,以及位置的定位,需要改变位置的可以使用填充。文字指向图片的地方还有个小三角,这个用border做,并且用position将其定位到相应的位置,
下面有右三角形的小例子,可以参考一下:
【GALLERY】
我用画图给你做了一个简单盒子布局,每一个框都是一个div,下面的6个div盒子是一样宽高的,我手画的不太标准。
外面的大盒子是要设置margin:0 auto的,这样就可以自适应居中显示。
如下图所示,需要把六个盒子添加浮动显示在一行。
此处,只需要定义一个div设置高度和宽度,背景色,以及文字的颜色、字体、大小就能实现。
3、第3个问题:为什么我的footer部分如果不加上fixed bottom:0就不能显示?
只要设置了fixed定位就要指定位置,不然元素不知道该在何处显示,虽然有的时候不写,表面上看是没有问题,但是实际上是存在隐患的,所以写了定位,就一定要指定位置。
如果帮助到了你,欢迎采纳!
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36713 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星