码迷,mamicode.com
首页 > Web开发 > 详细

CSS3 盒子模型子元素居中效果

时间:2014-08-04 10:44:27      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:style   http   color   os   ar   代码   html   div   

实现效果:

bubuko.com,布布扣

 

效果代码:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Document</title>

</head>

 

<style>

 

//在这里只设了webkit内核的实现效果,如果想让其它浏览器支持居中效果那么请用它们的前缀

div{width:200px;height:200px;border:1px solid orange;display:-webkit-box;-webkit-box-align:center;-webkit-box-pack:center;}

 

</style>

 

<body>

 

<div>

<p>我要居中</p>

</div>

 

</body>

</html>

CSS3 盒子模型子元素居中效果,布布扣,bubuko.com

CSS3 盒子模型子元素居中效果

标签:style   http   color   os   ar   代码   html   div   

原文地址:http://www.cnblogs.com/zion0707/p/3889399.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!