<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>大div中,三个小div水平居中</title>
<style>
*{
margin:0;
padding:0;
}
.big_div{
text-align: center;
margin: 0 auto;
padding: 0;
clear: both;
height: auto;
border: 1px solid red;
}
.small1,.small2,.small3{
width: 200px;
height: 200px;
line-height: 200px;
margin: 0;
padding: 0;
display: inline-block;
_display: inline;
*display: inline;
zoom: 1;
background: beige;
}
</style>
</head>
<body>
<div class="big_div">
<div class="small1">
小div1
</div>
<div class="small2">
小div2
</div>
<div class="small3">
小div3
</div>
<div style="clear:both"></div>
</div>
</body>
</html>

效果图如下:

大div中,三个小div水平居中的更多相关文章

  1. 为什么当多个inline-block的div中,如果有的div没有内容而有的div有内容,有内容的会下沉?

    为什么当多个inline-block的div中,如果有的div没有内容而有的div有内容,有内容的会下沉? 就像这样 两个div高度相同,第二个我写了一个1当作 有内容吧,它就下沉了... 奇怪... ...

  2. 小div在大div中垂直居中,以及div在页面垂直居中

    <html> <head> <title>淘宝 2faner</title> <style type="text/css"&g ...

  3. 一个大div里面包裹一个小div,里面的小div的点击事件不触发外面的这个大div的点击事件

    一开始上html代码 <div id="div1" style="background: blue;width: 100px; height: 100px;&quo ...

  4. 大div套多个小div,怎样设置外div的高度自适应?

    在最后一个div 后面加上 overflow:hidden;如下: <div style="width:580px; height:auto; margin:0 auto; <d ...

  5. div+css 让一个小div在另一个大div里面 垂直居中

    方法1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 .parent {           width:800px;           height:500px;       ...

  6. DIV中的文字垂直并且水平居中的CSS

    .MsgPopup { height: 100px; line-height: 100px; text-align: center;}

  7. 如何在一个div中使其子div居中

    网上其他地方已讲述过对其的不同实现方式,今天主要做一个详细的汇总,希望对大家有帮助. ps:我面试的时候就被问到过这个问题,当时都回答错了,蓝瘦. 假设父div的类名为father,子div的类名为s ...

  8. ThinkPHP框架下,jq实现在div中添加标签并且div的大小会随之变化

    php初学者,有什么不对的还请指正. 首先是在html页面中用jq实现添加标签:divAchivePersonnal是select所在的div的外层div,divselectAchivePersonn ...

  9. p标签在div中垂直居中,并且div高度随着p标签文字内容的变化而变化

    1.div设置flex布局 div{ display: flex; align-items: center; } 2.div不要设置height,设置min-height

随机推荐

  1. #381 Div2 Problem C Alyona and mex (思维 && 构造)

    题意 : 题目的要求是构造出一个长度为 n 的数列, 构造条件是在接下来给出的 m 个子区间中, 要求每一个子区间的mex值最大, 然后在这 m 个子区间产生的mex值中取最小的输出, 并且输出构造出 ...

  2. 【转载】Save terminal output to a file

    To write the output of a command to a file, there are basically 10 commonly used ways. Overview: Ple ...

  3. Oracle rac11g 安装报INS41112

    由于集群服务器上的数据库存储层要上双活,所以需要重置存储 不幸17服务器在重启后突然奔溃了,所以需要重新安装17服务器系统 在把18的软件全都卸载干净后,重新安装集群服务器,但却遇到了如下问题 多次针 ...

  4. [LeetCode]-DataBase-Trips and Users

    The Trips table holds all taxi trips. Each trip has a unique Id, while Client_Id and Driver_Id are b ...

  5. DataList是外部传入的子项数据列表

    //定义适配器类public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder>{ private C ...

  6. ACM ICPC 2011-2012 Northeastern European Regional Contest(NEERC)B Binary Encoding

    B: 现在有一种新的2进制表示法,要你求出0~m-1的每个数的表示. 规则如下:n 是满足 m<=2n 最小数. 而0~m-1的数只能够用n-1个位和n个位来表示. 对于n个位表示的数来说不能有 ...

  7. mysql高水位问题解决办法

    数据库中有些表使用delete删除了一些行后,发现空间并未释放产生原因:类比Oracle的高水位线产生原理 delete 不会释放文件高水位 truncate会释放 ,实际是把.ibd文件删掉了,再建 ...

  8. ls -i

    ls的不同选项有不同的含义: -l 是用long的长格式显示 条目信息 -a 显示所有的文件, 包括隐藏文件 -i: 是显示inode, 主要是用来查看硬链接的

  9. 解决samlexception-inresponsetofield-of-the-response-doesnt-correspond-to-sent-mess

    sp在校验samlresponse 根据id在session中的samlrequestid 取出,两者进行对比,这里如果做idp-init的话 可以注释掉. 1第一种方法 WebSSOProfileC ...

  10. Appium关键字

    *** Settings *** Library AppiumLibrary Library AutoItLibrary Library os *** Keywords *** xpath应该匹配次数 ...