dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Align a button in Javascript

  1. #1
    Join Date
    Nov 2012
    Posts
    2

    Align a button in Javascript

    Hello,
    I am very new to Javascript and other web related stuff.
    I am trying to align a button in a javascript file,

    The button is defined in an erb file like this
    <div id="button1" class="arial buttonprop ten right">CLICK ME ></div>

    In another javascript file user hides and shows this button
    $('#button1').hide();
    $('#button1').show();

    Is it possible to allign the button to left right or center in this Javascript file.

    Thanks,
    Georgy

  2. #2
    Join Date
    Nov 2012
    Posts
    14
    That looks like jQuery. You can use

    $('#button1').css()

    to set the location or change the alignment of the button.

  3. #3
    Join Date
    Nov 2012
    Posts
    2
    Thanks...

    I used the .css() function, i could able to do these things like

    1) float : left/right ---- for left/right alignment

    2) margin-left : value
    margin-right : value
    This also is good for left/right alignment

    But for aligning to the center i tried

    margin-left : auto
    margin-right : auto

    it doesn't seems to be working.

    So Is there any other way to align the button to the center

    Thanks
    Georgy

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles