zoukankan      html  css  js  c++  java
  • 多行文本在固定高度容量下的居中(转载)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

      <head>

      <title> 多行文字实现垂直居中 </title>

      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

      <style type="text/css">

    body { font-size:12px;font-family:tahoma;}

    div#wrap {display:table;border:1px solid #FF0099;background-color:#FFCCFF;760px;height:400px;*position:relative;/*hack IE6和IE7*/overflow:hidden;}

    div#subwrap { vertical-align:middle;display:table-cell;*position:absolute;/*hack IE6和IE7*/*top:50%;/*hack IE6和IE7*/}

    div#content { border:1px solid #000; *position:relative;/*hack IE6和IE7*/ *top:-50%;/*hack IE6和IE7*/}

      </style>

      </head>

      <body>

      <div id="wrap">

      <div id="subwrap">

      <div id="content">现在我们要使这段文字垂直居中显示!</div>

      </div>

      </div>

      </body>

    </html>

    转载的,忘记出处了!

  • 相关阅读:
    洛谷 P1244 青蛙过河
    洛谷 P1004 方格取数
    洛谷 CF894A QAQ
    【题解】洛谷 P5506 封锁
    洛谷 P3884 [JLOI2009]二叉树问题
    Bzoj4894 天赋
    Bzoj4893 项链分赃
    Bzoj3583 杰杰的女性朋友
    POJ3233 Matrix Power Series
    UOJ#204 【APIO2016】Boat
  • 原文地址:https://www.cnblogs.com/hushufang/p/3542243.html
Copyright © 2011-2022 走看看