惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
SecWiki News
SecWiki News
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 司徒正美
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
Y
Y Combinator Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
K
Kaspersky official blog
T
The Exploit Database - CXSecurity.com
腾讯CDC
Scott Helme
Scott Helme
I
InfoQ
Cyberwarzone
Cyberwarzone
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Security Latest
Security Latest
The Register - Security
The Register - Security
Project Zero
Project Zero
F
Fortinet All Blogs
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
C
Cisco Blogs
L
LINUX DO - 热门话题
P
Privacy International News Feed
IT之家
IT之家
U
Unit 42
P
Privacy & Cybersecurity Law Blog
H
Help Net Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Palo Alto Networks Blog
F
Full Disclosure
宝玉的分享
宝玉的分享
Simon Willison's Weblog
Simon Willison's Weblog
L
Lohrmann on Cybersecurity
Google DeepMind News
Google DeepMind News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
H
Hacker News: Front Page
Know Your Adversary
Know Your Adversary
PCI Perspectives
PCI Perspectives
Hugging Face - Blog
Hugging Face - Blog
AWS News Blog
AWS News Blog
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Recent Announcements
Recent Announcements
Forbes - Security
Forbes - Security
Cisco Talos Blog
Cisco Talos Blog

博客园 - puexine

解除一些网站利用【user-select: none;】禁止复制的限制! [nginx环境]Typecho安装在根目录与子目录的伪静态规则 Download VMware Workstation Pro css3 box-sizing属性 Google Chrome离线安装包下载 谷歌浏览器下载 Windows Defender Manually download the latest updates 纯CSS实现:垂直居中,未知宽高,已知宽高,IE5除外所有浏览器均兼容 常用公共DNS服务器地址 用户中心 - 博客园 VMWare CentOS 6.5 安装vmware-tools 彻底删除卸载Windows XP自带的Windows Message Windows Media Player Firefox Plugin支持Windows Server 2003的方法 微软软件运行库整理下载 – .NET Framework、VC++库、DirectX等 PIN码PJ教程,reaver 使用方法和技巧 Reaver基本命令参数详解及应用 另辟蹊径,CSS设置垂直居中 css实现固定高度及未知高度文字垂直居中的完美解决方案 显示器驱动程序已停止响应 并且已成功恢复 来自星星的你
使用 inline-block 水平垂直居中任意内容
puexine · 2016-04-11 · via 博客园 - puexine

挺好用的水平垂直居中任意内容代码,并且支持度很高

html

<!-- 注释用于去除 inline-block `间隙` -->
<div class="container"><!--
 --><div class="center">
            <h2>这个是居中标题</h2>
            <p>这里是一些文字,文字</p>
     </div><!--
--></div>

css

.container {
    text-align: center;
    width: 100%;
    height: 300px;
}
.container:before,
.container:after    /* :after 可以不需要 */
{
    display: inline-block;
    vertical-align: middle;
    content: '';
    height: 100%;
}
.center {
    display: inline-block;
    vertical-align: middle;
    max-width: 100%;
}

posted @ 2016-04-11 19:49  puexine  阅读(6294)  评论(0)    收藏  举报