Search code examples
javascriptbuttonhtmlpositioning

Javascript button in div layer positioning help


I currently have a div layer that includes some javascript (to display a button). I'm trying to position it on my webpage relative to the right hand side of the screen - how can I do this? I currently have something like this:

    <div id="LiveChat_1308239999" style="
    top:500;
    right:500;
    position: absolute;
    "><script type="text/javascript">
  var __lc_buttons = __lc_buttons || [];
  __lc_buttons.push({
    elementId: 'LiveChat_1308239999',
    language: 'en',
    skill: '0'
  });

(btw I do close the script and div, it just won't show up here)

But it is still just displaying in the top left corner of my screen.


Solution

  • You need to use a unit when specifying position values:

    top: 500px;
    right: 500px;
    

    Also, specifying a right value of 500 will put it 500px to the left of the right hand side - is that what you wanted?