...

View Full Version : absolute and relative postion



jonnyk92x
01-28-2012, 03:18 AM
#div-1 {
position:relative;
}
#div-1a {
position:absolute;
top:0;
right:0;
width:200px;
}

is it possible to make an absolute positioned element stay in a particular part of the page even when the window is expanded or made smaller. it wont stay in the area i want it.


<div id="div-1">
<div id="div-1a">i want this inside div-1 in the position i put without it moving with different size windows
</div></div>


I APPRECIATE THE HELP!! :)

D34th Maker
01-28-2012, 05:51 AM
i do not believe but i may be wrongs as absolute is from the top left corner of the webpage where the site is displayed, relative is from where the original order was, and fixes is like absolute but it will always appear even when scrolling.

jonnyk92x
01-28-2012, 07:11 AM
Actually I realized its not working bcuz im using javascript in the div i want to position. Is there anyway around this or maybe a code im using that I can change heres the code.


<div style="position:relative">


<script type="text/javascript">

if (ie4||DOM2)
document.write('<div style="position:relative"><div id="fscroller" style="position:absolute;top:0;left:0;border:0px solid black;width:'+fwidth+';height:'+fheight+'"></div></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent
</script>


</div>
its definently the js tho cuz i tried it without it and it worked. heres the function being used in js if it might have an effect

function changecontent(){

var index = Math.floor ( Math.random() * fcontent.length );
if (index>=fcontent.length)
index=0
if (DOM2){
document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
if (fadelinks)
linkcolorchange(1);
colorfade(1, 15);
}
else if (ie4)
document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
index++
}

Apostropartheid
01-29-2012, 12:24 AM
Actually I realized its not working bcuz im using javascript in the div i want to position. Is there anyway around this or maybe a code im using that I can change heres the code.


<div style="position:relative">


<script type="text/javascript">

if (ie4||DOM2)
document.write('<div style="position:relative"><div id="fscroller" style="position:absolute;top:0;left:0;border:0px solid black;width:'+fwidth+';height:'+fheight+'"></div></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent
</script>


</div>
its definently the js tho cuz i tried it without it and it worked. heres the function being used in js if it might have an effect

function changecontent(){

var index = Math.floor ( Math.random() * fcontent.length );
if (index>=fcontent.length)
index=0
if (DOM2){
document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
if (fadelinks)
linkcolorchange(1);
colorfade(1, 15);
}
else if (ie4)
document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
index++
}

I barely understood this. Please speak in Standard English on this forum.

It is very difficult to solve your problem without your full code.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum