效果图:

CSS:

 #container{
display:table-cell;
width:300px;
height:300px;
vertical-align:middle;
border:1px solid #ccc;
border-radius:20px;
text-align:center;
}
#cell{
margin: 0 auto;
width:100px;
height:100px;
border:1px solid red;
border-radius:10px;
}

HTML:

 <div id="container">
<div id="cell"></div>
</div>

DIV垂直居中对齐的更多相关文章

  1. div中字垂直居中对齐

    div中的文本水平居中,一般都是用text-align:center;就可以解决,那么垂直居中呢,知道vertiacl-align:middle;但有时候却不起作用:整理下div中文本垂直居中对齐的问 ...

  2. html文本垂直居中对齐

    html文本垂直居中对齐,代码如下: <div id="box" style="height:100px; line-height:100px; border:1p ...

  3. CSS垂直居中对齐

    用CSS有多种方法实现垂直居中对齐.如果已知外部div的高度,不管是否知道内部div的高度,垂直居中实现起来很简单,但如果内部div高度是变量,如文字,垂直居中实现起来就比较复杂了,很可能需要使用ha ...

  4. css-实现元素垂直居中对齐

    css-实现元素/元素内容,垂直居中对齐 一.单行内容的垂直居中(line-height:行高方法) 只考虑单行是最简单的,无论是否给容器固定高度,只要给容器设置 line-height 和 heig ...

  5. bootstrap modal 垂直居中对齐

    bootstrap modal 垂直居中对齐   文章参考 http://www.bubuko.com/infodetail-666582.html http://v3.bootcss.com/Jav ...

  6. css 文本和div垂直居中方法汇总

    https://blog.csdn.net/u014607184/article/details/51820508 https://blog.csdn.net/liuying1802028915/ar ...

  7. CSS 文本垂直居中对齐

    文本垂直居中对齐是一个很常见的问题,这里总结一下. 一.容器高度固定,单行文本垂直居中对齐 height:20px; line-height:20px; overflow:hidden; 二.容器高度 ...

  8. Div 居中对齐(水平、垂直)

    一:水平居中对齐 ***********************************************************************************  示例图 代码 ...

  9. div垂直居中的几种方法

    CSS教程:div垂直居中的N种方法[转](原文地址:http://www.cnblogs.com/chuncn/archive/2008/10/09/1307321.html) 在说到这个问题的时候 ...

随机推荐

  1. php7配置多线程

    1.下载pthreads 文件  http://windows.php.net/downloads/pecl/releases/pthreads/3.1.5/ 2.把   pthreadVC2.dll ...

  2. python 小练习2

    给你一个整数列表L,判断L中是否存在相同的数字, 若存在,输出YES,否则输出NO.解1l=[]for i in L:    if L.count(i) != 1:        print('YES ...

  3. 【转】Vue 脱坑记 - 查漏补缺(汇总下群里高频询问的xxx及给出不靠谱的解决方案)

    前言 文章内容覆盖范围,芝麻绿豆的破问题都有,不止于vue; 给出的是方案,但不是手把手一字一句的给你说十万个为什么! 有三类人不适合此篇文章: “喜欢站在道德制高点的圣母婊” – 适合去教堂 “无理 ...

  4. leetcode Most Common Word——就是在考察自己实现split

    819. Most Common Word Given a paragraph and a list of banned words, return the most frequent word th ...

  5. vue element-ui 通过v-for渲染的el-form-item组件,使用自带的表单验证

    HTML: <el-form ref="newTermDetail" :model="newTermDetail" class="auto_fo ...

  6. JavaScript中 null 的 typeof是object

    JavaScript中  null 的 typeof是object

  7. MySQL修改root密码教程

    1.记得密码但想要更新密码 mysql -uroot -p #使用当前密码登录mysql update MySQL.user set password=PASSWORD('新密码') where Us ...

  8. Notation, First Definitions 转 http://brnt.eu/phd/node9.html

    LaTeX command Equivalent to Output style Remarks \textnormal{...} {\normalfont...} document font fam ...

  9. python运算符号

    运算符 比较运算 赋值运算 逻辑运算 成员运算

  10. 用linq和datatable巧妙应用于微软报表rdlc

    看看代码吧.现在我用Linq已经上瘾,对SQL语言已经几乎不用了,可惜的是rdlc不支持linq,要采用sql语言生成datatable,用datatable绑定rdlc,这里,应用了一个技巧,解决了 ...