Blogger Information
Blog 10
fans 0
comment 0
visits 5140
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
3月23号作业
小议的博客
Original
457 people have browsed it

3月23号作业

代码:

实例

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>3-23作业</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style type="text/css">

	.box1 {
		width: 250px;
		height: 250px;
		background-color:#FFFFE0;
		text-align: center;	/*行内元素水平居中*/
		line-height: 300px;	/*使行内元素垂直居中*/

	}
	.box2 {
		width: 250px;
		height: 250px;
		background-color:#FF00FF;
		text-align: center; /*水平居中*/
		display: table-cell;	/*将默认display属性值修改为表格单元格table-cell*/
		vertical-align: middle; /*设置单元格内的元素垂直居中*/
	}
	.box3 {
		width: 250px;
		height: 250px;
		background-color:#FF0082;
		display: table-cell;	/*将默认display属性值修改为表格单元格table-cell*/
		vertical-align: middle; /*设置单元格内的元素垂直居中*/
	}
	.box3_1 {
		width: 100px;
		height: 100px;
		background-color:#019789;
		margin: auto;	/*使子元素水平居中*/

	}
	.box4 {
		width: 250px;
		height: 250px;
		background-color:#C9EAC8;
		text-align: center;
		display: table-cell;	/*将默认display属性值修改为表格单元格table-cell*/
		vertical-align: bottom; /*设置单元格内的元素底边居中*/


	}
	div ul {
		padding: 0px;

	}
	div ul li {
		list-style: none;
		display: inline;	

	}
</style>
</head>
<body>
	<p>单行文本,行内元素在块元素中水平垂直居中</p>
    <div class="box1">
    	<a href="">PHP中文网</a>
    </div>

    <hr>
    <p>多行文本,行内元素在块元素中水平垂直居中</p>
    <div class="box2">
    	<a href="">百度</a>
    	<span>www.baidu.com</span>
    </div>

    <hr>
    <p>块元素水平垂直居中</p>
    <div class="box3">
    	<div class="box3_1">jsadk</div>
    </div>
    <hr>
    <p>不定宽块元素居中</p>
    <div class="box4">
    	<ul>
    		<li><a href="">1</a></li>
    		<li><a href="">2</a></li>
    		<li><a href="">3</a></li>
    		<li><a href="">4</a></li>
    		<li><a href="">5</a></li>
    	</ul>
    </div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

手抄代码截图:

1.jpg


2.jpg3.jpg

Correction status:qualified

Teacher's comments:记得及时修改作业哦!要求群文件中有哦!
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post