1、多行行文字在固定高度的div中垂直居中,只兼容高级浏览器和移动端

.detail {
width: 395px;
height: 289px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-pack: center;
-webkit-box-align: left;

display: -moz-box;
-moz-box-orient: vertical;
-moz-box-pack: center;
-moz-box-align: left;

display: -o-box;
-o-box-orient: vertical;
-o-box-pack: center;
-o-box-align: left;

display: -ms-box;
-ms-box-orient: vertical;
-ms-box-pack: center;
-ms-box-align: left;

display: box;
box-orient: vertical;
box-pack: center;
box-align: left;
}

<div class="pull-left detail">
   <h1 class="show-title">所见即<span>所得</span></h1>
   <p>我用完之后是这个样子,你们用完之后也会是这个样子!-成龙</p>
</div>

2、固定高度div中不固定长宽的img垂直水平居中,兼容ie6

 .pic-area .main-pic {
  display: table-cell;
  width: 700px;
  height: 465px;
  line-height: 465px;
  text-align: center;
  vertical-align: middle;

/* 针对IE的Hack */
  _display: inline;
  *font-size: 405px;/*约为高度的0.873,465*0.873 约为405*/
  *font-family: Arial;/*防止非utf-8引起的hack失效问题,如gbk编码*/
}

.pic-area .main-pic img {
max-width: 700px;
max-height: 465px;
line-height: 465px;
text-align: center;
vertical-align: middle;
zoom:1;
_width: expression((this.width)>=700?"700":"auto");
_height: expression((this.height)>=465?"465":"auto");
}

css-div下内容垂直居中的更多相关文章

  1. div垂直居中 css div盒子上下垂直居中

    div垂直居中 css div盒子上下垂直居中,让DIV盒子在任何浏览器中任何分辨率的显示屏浏览器中处于水平居中和上下垂直居中. div垂直居中常用于单个盒子,如一个页面里只有一个登录布局,使用div ...

  2. div+css:div中图片垂直居中

    div中图片垂直居中 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> &l ...

  3. css div中内容绝对居中(多行内容)

    div中的内容绝对居中(不适合IE6哦,IE6我已经不考虑了),直接看代码吧. <!DOCTYPE HTML> <html> <head> <title> ...

  4. css div 自适应内容

    .adapt-content{ display:inline-block; *display:inline; ; } 见:http://www.cnblogs.com/refe/p/5051661.h ...

  5. CSS总结div中的内容垂直居中的五种方法

    一.行高(line-height)法 如果要垂直居中的只有一行或几个文字,那它的制作最为简单,只要让文字的行高和容器的高度相同即可,比如: p { height:30px; line-height:3 ...

  6. 使用CSS使内容垂直居中的N中方法。

    使用css+div使页面内容水平居中的方法大家并不陌生,那么如何使内容垂直居中呢? OK,下面进入正题,不如我们使用做高中数学题时经常用的思想:分情况讨论.   1.当待垂直居中的DIV高宽为已知时: ...

  7. [转]如何让div中的内容垂直居中

    转自:http://blog.163.com/yan_1990/blog/static/197805107201211311515454/ 虽然Div布局已经基本上取代了表格布局,但表格布局和Div布 ...

  8. 如何让div中的内容垂直居中

    虽然Div布局已经基本上取代了表格布局,但表格布局和Div布局仍然各有千秋,互有长处.比如表格布局中的垂直居中就是Div布局的一大弱项,不过好在千变万化的CSS可以灵活运用,可以制作出准垂直居中效果, ...

  9. div+css 布局下兼容IE6 IE7 FF常见问题

    div+css 布局下兼容IE6 IE7 FF常见问题 收藏 所有浏览器 通用 (市面上主要用到的IE6 IE7 FF)height: 100px; IE6 专用 _height: 100px; IE ...

随机推荐

  1. Apache HttpServer Installing the apache2.2 service <OS 5>拒绝访问. :Failed to open the WinNT service manager

    Installing the apache2.2 service<OS 5>拒绝访问.  :Failed to open the WinNT service manager 只需要于管理员 ...

  2. C/C++基础知识总结——多态性

    1. 多态性的概述 1.1 多态是指同样的消息被不同类型的对象接收时导致不同的行为.所谓消息是指对垒的成员函数的调用,不同行为是指不同的实现. 1.2 多态的实现 (1) 实现角度讲多态可分为两类:编 ...

  3. 使用WCF扩展在方法调用前初始化环境

    使用WCF扩展在方法调用前初始化环境 OperationInvoker 介绍 OperationInvoker 是 WCF 运行时模型中在调用最终用户代码前的最后一个扩展点,OperationInvo ...

  4. hdu1358

    Problem Description For each prefix of a given string S with N characters (each character has an ASC ...

  5. Java设计模式透析之 —— 适配器(Adapter)

    转载请注明出处:http://blog.csdn.net/sinyu890807/article/details/9400141 今天一大早,你的leader就匆匆忙忙跑过来找到你:“快,快,紧急任务 ...

  6. 使用Func<T1, T2, TResult>

    使用Func<T1, T2, TResult> 委托返回匿名对象   Func<T1, T2, TResult> 委托 封装一个具有两个参数并返回 TResult 参数指定的类 ...

  7. [Android开发常见问题-11] Unable to execute dex: Multiple dex files define 解决方法

    最近在开发一个工程,其中用到了一个开源的库项目Android-ViewPagerIndicator. 这个项目是作为一个库出现的,如下图: 这个项目中包含了android-support-v4.jar ...

  8. 基于内容的图片检索CBIR(Content Based Image Retrieval)简介

    传统的图像检索过程,先通过人工对图像进行文字标注,再利用关键字来检索图像,这种依据图像描述的字符匹配程度提供检索结果的方法,简称“以字找图”,既耗时又主观多义.基于内容的图像检索客服“以字找图”方式的 ...

  9. 12503 - Robot Instructions

      Robot Instructions  You have a robot standing on the origin of x axis. The robot will be given som ...

  10. 筛选实现C++实现筛选法

    每日一贴,今天的内容关键字为筛选实现 筛选法 分析: 筛选法又称筛法,是求不超越自然数N(N>1)的全部质数的一种方法.据说是古希腊的埃拉托斯特尼(Eratosthenes,约公元前274-19 ...