日期:2014-05-16  浏览次数:20822 次

asp.net首页自适应分辨率浏览器
各位大神,帮帮忙。

我正在用asp.net做一个首页,希望背景图片根据不同分辨率自适应居中全屏显示,另外能兼容各主流浏览器。
另外,首页上还有四个图片按钮,希望能在不同分辨率和浏览器下固定在屏幕的某个位置,而不会因为不同分辨率或浏览器而跑掉。

能否指明方向,跪谢!

------解决方案--------------------
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-type" content="text/html;charest=UTF-8">
<title></title>
<style type="text/css">
#login{position: relative;background:url(images/image5.jpg) center center no-repeat;height:1000px;}
input{width:100px;margin:10px;}
.ad{position:absolute;width:500px;top:50%;left:50%;margin-left:-250px;}

</style>
</head>
<body>
<input type = "text" id = "aa"><input type = "button" value = "click" id = "bb"/>
<div id="login">
<div class = "ad"><input type = "text"/><input type = "text"/><input type = "text"/><input type = "text"/></div>
</div>
</body>
</html>


比如这样你试试,

你把背景图片设置为上下左右都居中就可以了,然后另外的几个按钮就放到一个div里面,然后去定位这个div。

我这里采用的定位加上外边距,把div定位到页面的上下左右居中的位置。可以通过这样的方法,定位到你想要的地方,不过,为了浏览器的分辨率什么的,最好用百分比进行处理。。