博主信息
博文 15
粉丝 0
评论 0
访问量 12342
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
3.23作业
的博客
原创
742人浏览过

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>四个对齐演示</title>
	<style>
		.contentone{ width:600px; margin: 0 auto; background-color: #e6e6e6;}
		.contenttwo{ width:600px; margin: 0 auto; background-color: #e6e6e6;padding-top: 20PX;display:table-cell;vertical-align:middle;}
		.contentthree{ width:600px; margin: 0 auto; background-color: #e6e6e6;display:table-cell;vertical-align:middle;}
		.one {height: 80px;margin-top: 10px;}
		.one p{text-align: center;line-height: 80px;background-color: #f00;}
		.two{background-color: #F00;text-align:center;}
		.two span{line-height: 100PX;}
		.three{width: 100px;height: 100px;}
		.contentthree .three { margin: auto;  }
		.contentfour{}
		.four{text-align: center;vertical-align:bottom;height: 50px;}
		.four ul {background-color: #f00;line-height=parent.height;line-height: 50px;}
		.four li{list-style: none;display: inline;}

	</style>
</head>
<body>
<div class="contentone">
<h3>1、行内对齐</h3>
<div class="one"><p>我是一行</p></div>


<div class="contenttwo">
<h3>2、多行内联文本</h3>
<div class="two">
	<span>哎吆不错哦</span>
	<span>哎吆不错哦</span>
</div>
</div>


<div class="contentthree">
<h3>3、块元素居中</h3>
<div class="three"><img src="http://www.php.cn/tpl/Index/Static/css/img/common/logo.png?t=1" alt=""></div>
</div>



<div class="contentfour">
<h3>4、不定宽的块元素</h3>
<div class="four">
<ul>
	<li>点我</li>
	<li>点我</li>
	<li>点我</li>
	<li>点我</li>
</ul>

</div>

</body>
</html>

运行实例 »

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

QQ截图20180323153444.jpg

批改状态:合格

老师批语:
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学