|
Posted by Nony Buz on 05/31/06 11:57
On 2006-05-30, Neredbojias <> wrote:
> To further the education of mankind, Nony Buz <noya@dwtty.com> vouchsafed:
>
>> I have a simple question:
>>
>> I have a given work space, 760x420, full screen for the 800x600
>> user. When a user running at 800x600 views my site, I want the
>> main workspace DIV to not have any space at the top. But if there
>> is enought room, I want there to be a 40px margin between the
>> 760x420 and the top of the browser. How do I do that without
>> server side code?
>
> Javascript.
>
> if (screen.width>800) document.getElementById
> ('workdiv').style.marginTop='40px';
I tried it and it does not seem to work in either Firefox or IE.
here is my code:
<html>
<head>
<title>New Website</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #000033;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
margin: 0px auto;
text-align: center;
}
#main {
background-image: url(images/BlueGray.gif);
height: 420px;
width: 760px;
margin: 0px auto;
text-align: left;
}
-->
</style>
</head>
<script type=text/javascript>
if (screen.width>800)
document.getElementById('main').style.marginTop='40px';
</script>
<body>
<div id="main">
</div>
</body>
</html>
Navigation:
[Reply to this message]
|