css图片自动绽放大小,左右,上下居中

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>无标题页</title>
    <style type="text/css">
        .pic
        {
        	max-height:400px;
        	max-width:400px;
        	_width:expression("400px");
        	_height:expression((document.documentElement.clientHeight||document.body.clientHeight)>400?"400px":"");
            /*_width:expression((document.documentElement.clientWidth||document.body.clientWidth)>(document.documentElement.clientHeight||document.body.clientHeight)?"400px":"");*/
            /*_height:expression(document.documentElement.clientWidth>document.documentElement.clientHeight?(document.documentElement.clientHeight*(400*2-68)/document.documentElement.clientWidth+"px"):"400px");*/
            overflow:hidden;
            margin-left:-55px;
            margin-Right:-55px;
            padding:0px;
        }
        table
        {
        	width:400px;
        	height:400px;
        	border:0px;
        	border-collapse:collapse;
        	margin:0px;
        	padding:0px;
        }
        
        tr
        {
        	margin:0px;
        	padding:0px;
        	width:400px;
        	height:400px;
        }
        
        td
        {
        	text-align:center;
        	margin:0px;
        	padding:0px;
        	width:400px;
        	height:400px;
        }
        
    </style>
</head>
<body>
    <div style="border:solid 1px blue;width:400px;height:400px;margin:0px;background-color:Gray;">
        <table>
            <tr>
                <td>
                    <img class="pic" src="123.jpg" alt=""/>
                </td>
            </tr>
        </table>
    </div>
    <br />
    <br />
    <br />
    <br />
    <br />
    <div style="border:solid 1px blue;width:400px;height:400px;margin:px;background-color:Gray;">
        <table>
            <tr>
                <td>
                    <img class="pic" src="456.jpg" alt=""/>
                </td>
            </tr>
        </table>
    </div>
</body>
</html>

 
 
 
  
  
  
  

你可能感兴趣的:(左右,css图片自动绽放大小,上下居中)