效果图:

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. 关于Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op.的解决方案

    Warning: setState(...): Can only update a mounted or mounting component. This usually means you call ...

  2. leetcode-algorithms-17 Letter Combinations of a Phone Number

    leetcode-algorithms-17 Letter Combinations of a Phone Number Given a string containing digits from 2 ...

  3. vector底层实现

    https://blog.csdn.net/u012658346/article/details/50725933 各个stl容器区别 https://blog.csdn.net/shawjan/ar ...

  4. weblogic查看版本号教程

    1.查看软件版本号 cd /weblogic/bea/wlserver_10.3/server/lib java -cp weblogic.jar weblogic.version 说明:版本号后边的 ...

  5. hibernate配置log

    hibernate依赖jboss-logging,通过它选择对应的对应的日志包,选择的逻辑课查看具体代码org.jboss.logging.LoggerProviders. 先通过系统变量(org.j ...

  6. linux network

    Linux 1◆ 提供连接     2◆ connection baidu.com 3◆ vm tools install Reboot    

  7. Java IO流01-总叙

     Java IO包体系结构图: 1.流式部分――IO的主体部分: 2.非流式部分——主要包含一些辅助流式部分的类,如:File类.RandomAccessFile类和FileDescriptor等类: ...

  8. Spring框架基本代码

    1.准备阶段: 2.基本引入: 接口: package com.xk.spring.kp01_hello; public interface IHello { public void nice(); ...

  9. [Leetcode 122]买股票II Best Time to Buy and Sell Stock II

    [题目] Say you have an array for which the ith element is the price of a given stock on day i. Design ...

  10. [Leetcode 104]求二叉树的深度Depth of BinaryTree

    [题目] Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the ...