博客
关于我
图片预览自适应固定宽高div
阅读量:371 次
发布时间:2019-03-05

本文共 698 字,大约阅读时间需要 2 分钟。

<!DOCTYPE html><html lang="en"><head>	<meta charset="UTF-8">	<title>Document</title>	<style type="text/css">		li{			list-style: none;			float: left;			margin-left: 10px;			width: 200px;			height: 160px;			border: 1px solid #ccc;			text-align: center;			line-height: 160px;		}		img{			vertical-align:middle;		}	</style></head><body>	<li>		<img src="1.jpg">	</li>	<li>		<img src="2.png">	</li>		<script type="text/javascript" src="jquery-1.12.4.js"></script>	<script type="text/javascript">	$(function(){		$.each($('img'),function(i,item){			if($(this).outerWidth()>$(this).outerHeight()){				$(this).css('width','100%');			}else{				$(this).css('height','100%');			}		});	});	</script></body></html>

转载地址:http://kxdwz.baihongyu.com/

你可能感兴趣的文章
【LeetCode】归并排序(python版)
查看>>
通信基础知识
查看>>
DSP开发板准备
查看>>
测试基本
查看>>
5.redo undo
查看>>
编码格式简介(ANSI、GBK、GB2312、UTF-8、GB18030和 UNICODE)
查看>>
《JVM的内存》
查看>>
c++中istringstream及ostringstream超详细说明
查看>>
c++中ifstream及ofstream超详细说明
查看>>
c++中endl操作符以及它的兄弟们
查看>>
c++中explicit和mutable关键字探究
查看>>
c语言结构体字节对齐详解
查看>>
linux c/c++面试知识点整理(八)
查看>>
epoll的基本使用
查看>>
linux网络编程系列(十二)--滑动窗口、拥塞控制、断线重连机制
查看>>
c++11&14-编译
查看>>
Deep residual learning for image recognition
查看>>
IO控制方式
查看>>
IO控制器
查看>>
Java 异常
查看>>