Click to See Complete Forum and Search --> : Layer Question
TurtleEKH
03-19-2003, 05:28 PM
I want to have a layer set to be centered on a page based on browser size. i.e. The layer will be centered within the browser regardless of whether it is being viewed on a laptop or on a 21 inch monitor. Any thoughts on a simple way to do this?
For IE and NN, take a look at this link: http://www.infinitypages.com/research/verticalcentereddiv.htm
TurtleEKH
03-19-2003, 06:48 PM
Thanks for the response! This time I have included the code I am using below.... I need to use something that is comperable to bothe NN and IE - and also, I don't want the user to have to refresh for it to change the size. I want it to automatically adjust based on browser size only... What the heck am I doing wrong? The code below puts the layer halfway off my screen, and no matter what percentage I use for the left - is still not working all all resizes....
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
}
#Layer1 {
position: absolute;
width: 800px;
height: 600px;
left: 50%;
top: auto;
z-index: 1;
margin-left: 0px;
margin-top: 0px;
font-family: Arial, Helvetica, sans-serif;
background-attachment: fixed;
background-image: url(images/background.gif);
background-repeat: no-repeat;
}
.maintext {
font-family: "Courier New", Courier, mono;
font-size: 14px;
color: #333333}
.header {
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
color: #CCCCCC
}
-->
</style>
Did you try my code? It will center itself on the users screen. Also, if you want it to automatically adjust if the user resizes their browser, you can use the onresize command.