<style type="text/css">
div{border:1px solid #ccc;height:500pc;width:500px;text-align:center;margin:0 auto;background:#ccc;}
img{vertical-align:middle;}
div span{height:100%;width:0;oveflow:hidden;display:inline-block;vertical-align:middle;}
</style>
<div class="text">
<img src="1.png"/><span></span>
</div>

css div图片上下左右居中的更多相关文章

  1. 只用CSS实现容器内图片上下左右居中

    一直以来,大家都知道,DIV容器内设置 text-align:center 即可让图片居中,但是DIV内默认的图片是上对齐,不会上下居中,如果想要实现这样的效果,JS判断是比较麻烦的,因为DIV容器内 ...

  2. div元素上下左右居中

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  3. CSS 控制元素 上下左右居中

    不说废话,直接 搞起..... 首先,我们将题目 <css控制元素上下左右居中> 分析一下哈,我是将其分成了4部分信息: 1.CSS控制: 只用 CSS 来达成目的 2.元素:  不只是d ...

  4. div层上下左右居中

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

  5. html/css系列-图片上下居中

    本文详情:http://www.zymseo.com/276.html图片上下居中的问题常用的几种方法:图片已知大小和未知大小,自行理解 .main{ width: 400px;height: 400 ...

  6. 用CSS使图片上下左右都绝对居中于DIV

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

  7. 多行文字在一个div中上下左右居中

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

  8. 使一个div元素上下左右居中

    第一种方法 浮动流自我调节 .box{ widht:200px; height:200px; position:relative; } .box .son{ width:100px; height:1 ...

  9. CSS DIV中表格居中显示

    将div的text-align设为center,然后将table的margin设为auto,即: <div> <table style="margin:auto; widt ...

随机推荐

  1. [解决]java.io.IOException: Cannot obtain block length for LocatedBlock

    在hadoop测试集群运行job的过程中发现部分运行失败,有Cannot obtain block length for LocatedBlock,使用hdfs dfs -cat ${文件}的时候也报 ...

  2. python 面试题(1)

    好用简洁的大数据技术:python.hadoop.R 慢慢学习,随时分享 1.什么是Python?使用Python有什么好处? Python是一种编程语言,它有对象.模块.线程.异常处理和自动内存管理 ...

  3. Xamarin入门浅析

    1. 安装 1) 使用标准安装流程(JDK1.6 -> Android SDK -> NDK -> Xamarin Studio -> Xamarin Visual Studi ...

  4. Mantis 从Windows 迁移到Linux上

    1. 导出windows manits的mysql数据库文件, 在cmd运行:mysqldump -uroot -p3edc$RFV bugtracker > C:/mantis.sql; 2. ...

  5. 【CODEVS】3546 矩阵链乘法

    [算法]区间DP [题解] 注意先输出右括号后输出左括号. f[i][i+x-1]=min(f[i][i+x-1],f[i][j]+f[j+1][i+x-1]+p[i]*p[j+1]*p[i+x]) ...

  6. 代理设计模式iOS开发Demo(示例程序)源代码

        iOS程序源代码下载链接:03-代理设计模式.zip28.3 KB // main.m // //  main.m //  03-代理设计模式 // //  Created by apple ...

  7. Reachability from the Capital(Codeforces Round #490 (Div. 3)+tarjan有向图缩点)

    题目链接:http://codeforces.com/contest/999/problem/E 题目: 题意:给你n个城市,m条单向边,问你需要加多少条边才能使得从首都s出发能到达任意一个城市. 思 ...

  8. zabbix的命令执行

    1.对于低版本的可用下列exp直接打到用户 http://119.29.48.232/zabbix/httpmon.php?applications=2 and (select 1 from (sel ...

  9. HDU 1070 Milk (模拟)

    题目链接 Problem Description Ignatius drinks milk everyday, now he is in the supermarket and he wants to ...

  10. 关于:TypeConverter 无法从 System.String 转换

    TypeConverter 无法从 System.String 转换 处理方法: 1: [DX Support Team: The issue was resolved by its Owner] i ...