Dear experts, please give me some advice. I have a jsp login page here. In addition to the input boxes and buttons on the page, there is a background image. The positions of the input boxes are all relative positions. However, after IE or resolution adjustment, the input box and background image will still be misaligned. I would like to ask everyone, how can I make the background image change with the changes of IE and resolution? ?
Please give me some advice from all the experts! ! ! ! The page code is as follows:
login.jsp:
<%@ page contentType="text/html;charset=gb2312" language="java" import="java.util.*,com.iproject.examsys. web.to.*" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
if(request.getSession (true).getAttribute(UserSessionInfo.USER_SESSION)!=null){
response.sendRedirect("examination/index");
}
response.setHeader("Pragma", "No-cache") ;
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
String path = request.getContextPath();
String basePath = request.getScheme() "://" request.getServerName() ":" request.getServerPort() path "/";
%>
背景图要使用百分比,必须使用CSS3,ie9之前的浏览器不支持的。
你不要采用相对定位的方法,直接设置固定的宽度和高度实现
有一个 不是办法的办法,如果不考虑根据分辨率自适应之后的拉伸问题的话可以这么写先给 大外层 一个 position:relative 。然后 单独在这个层里面建立一个层
The corresponding css is written like this .bgimg{width:100%;height100%;position:absolute;z-index:xxx;} .bgimg img{width:100%;height:100%;}In fact The principle is to put this picture at the bottom of the page to fool the visual effect into thinking it is a background. Then stretch this layer. I think stretching a layer is much simpler than stretching a background.
Are you upstairs? After I followed your method, the positions of the page and the input box are now relatively static. But a new problem arises, that is, the page and input appear on the right side of the entire IE. The originally set width = 100%, but in fact the background does appear at IE50%, and then goes to the right to IE150%. .
The code is as follows, please, please, and also all the experts can help me take a look and give me some advice, thank you!
login.jsp code is as follows:
<%@ page contentType="text/html;charset=gb2312" language="java" import="java.util.*,com.iproject.examsys .web.to.*" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
if(request. getSession(true).getAttribute(UserSessionInfo.USER_SESSION)!=null){
response.sendRedirect("examination/index");
}
response.setHeader("Pragma", "No-cache" );
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
String path = request.getContextPath();
String basePath = request.getScheme() "://" request.getServerName() ":" request.getServerPort() path "/";
%>
I did it myself! ! Haha, I broke out in a sweat! Although I got it done by myself in the end, I still have to thank you upstairs, your idea is very clever!
How did the poster solve the problem? Please give me some guidance