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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>文本图片水平垂直居中</title>
    <style type="text/css">
    .wrap
    {
    text-align
    :center;
    width
    :500px;
    height
    :500px;
    background-color
    :#0F9;
    vertical-align
    :middle;
    display
    :table-cell;/*非IE6*/
    position
    :relative;
    }
    .wrap2
    {
    *position
    :absolute;
    *top
    :50%;
    *left
    :50%
    }
    .con
    {
    width
    :270px;
    *position
    :relative;
    *top
    :-50%;
    *left
    :-50%;
    border
    :1px solid #000;
    display
    :inline-block;

    }
    img
    { /*图片放入DIV中IE6下,有下边距BUG的3中解决方法 vertical-align:bottom 或 font-size:0 或*/ display:block;}
    </style>
    </head>
    <body>
    <div class="wrap">
    <div class="wrap2">
    <div class="con">
    <a href="#">居中居中居中居中居中居中居中居中居中居中居中居中居中居中</a><img src="http://www.baidu.com/img/baidu_logo.gif" /></div>
    </div>
    </div>
  • 相关阅读:
    java导出pdf格式文档
    本地文件夹选择框
    将文件解除占用
    Windows 进入上帝模式窗口
    Windows 10 系统获取密钥方法
    CentOS7 systemctl 命令
    一键立即息屏
    定时关闭程序
    CentOS 7 FTP的安装与配置
    SQL基础
  • 原文地址:https://www.cnblogs.com/bennman/p/1955168.html
Copyright © 2011-2022 走看看