展会信息港展会大全

CSS+DIV设计实例实现让多个DIV排列时居中
来源:互联网   发布日期:2016-03-25 16:24:29   浏览:1227次  

导读:代码如下 复制代码 ?xml version=1.0 encoding=iso-8859-1? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml head titleUntitled Document...

代码如下

复制代码

<?xml version="1.0" encoding="iso-8859-1"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style type="text/CSS">

body {text-align:center}

#outer {

width:60%;

background:#ffffcc;

margin:auto;

text-align:center;

}

.inner {

width:100px;

height:100px;

margin:5px;

border:1px solid #000;

}

* html .inner {display:inline}/* for ie*/

html>body #outer {display:table}/*for mozilla */

html>body .inner {display:table;float:left}/*for mozilla */

@media all and (min-width: 0px){/* opera 7 styles */

html>body .inner {display:inline-block;float:none;}

}

</style>

</head>

<body>

<!-- force quirks mode by using the xml pro-logue -->

<div id="outer">

<div class="inner">test</div>

<div class="inner">2</div>

<div class="inner">3</div>

<div class="inner">4</div>

<div class="inner">5</div>

<div class="inner">6</div>

<div class="inner">7</div>

<div class="inner">8</div>

<div class="inner">9</div>

<div class="inner">10</div>

<div class="inner">11</div>

<div class="inner">12</div>

<div class="inner">13</div>

<br style="clear:both" />

</div>

</body>

</html>

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港