1. 程式人生 > >圖片自適應大小

圖片自適應大小

<!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">
#con
{
  width:80%;
  height:80%;
  max-width:350px;
  min-width:200px;
  border:1px solid red;
}
</style>
</head>
<body>
<center> 

<div id="con">
	<img src="test.jpg" style="height: 100%; width:100%;" />
</div>

</center>
</body>
</html>