Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    absolute and relative postion

    Code:
    #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.

    Code:
    <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!!

  • #2
    New Coder
    Join Date
    Jan 2012
    Posts
    53
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    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
    Code:
    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++
    }

  • #4
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by jonnyk92x View Post
    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.

    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
    Code:
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •