简体   繁体   中英

How will i position all the content in a webpage so that even if the browser size change or the screen resolution, all will still be in place?

I am making a (for fun :P) a lock screen using Firefox browser and my own made webpage. what i did is install a R-kiosk adds on to force Firefox to launch in full screen, made my webpage its homepage, and set it to run at start up. My code works fine in my laptop, but i had a problem. If the browser size or screen size is changed, so does... well... everything. the text box will be positioned far from where i want. the button is just as misplaced. so far this is what i've come up:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LogIn</title>
<style>
body{margin:0; padding: 0;}
.bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -5000;

}
table {
    width: 100%;
    border: 0;
    margin: 0;
    padding: 0;
}

</style>
<script type="text/javascript">
function cia(){
    if ((document.getElementById('pass').value == "amethyst")){
        document.getElementById('audio').play();
        document.login.src="loading.gif";
        setTimeout('window.close()',8000);
    }
    else{
    alert('Error! Invalid combination. Please try again.');
    location.reload();
    }
}

</script>
</head>
<body><div align="center"><img src="img.jpg" class="bg"/></div><form name="formL" id="formL"><table>
 <tr><td height="413">&nbsp </td></tr>
  <tr>
    <td width="49%" height="45">&nbsp;</td>
    <td width="51%"><input id= "un" type="text" value="MidGuardiaN"/></td>
  </tr>
    <tr>
    <td width="49%">&nbsp;</td>
    <td width="51%"><input id="pass" name="pass" type="password" value="" autofocus="autofocus" onKeydown="Javascript: if (event.keyCode==13)cia();"/></td>
  </tr>
</table>
<table>
   <tr>
    <td width="49%">&nbsp;</td>
    <td width="51%"><a href="javascript:;" onClick="cia()" > <img name="login" src="login.png"/></a></td>
  </tr>
</table>
</form>
<audio id="audio" src="welcome.mp3" ></audio>
</body>
</html>

Hope you can help me improve this. thanks.

您需要研究响应式Web设计

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM