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 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2013
    Posts
    80
    Thanks
    40
    Thanked 0 Times in 0 Posts

    Question How can I add a "center" to this javascript code?

    I have this javascript code from twitter (tweet button), and Im trying to get it to center in my sidebar. I tried to add a style in there, but it doesn't change anything.

    Code:
    <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://jeffreydowellphotography.com" style="display:block; vertical-align:middle; padding-left:15px;" data-text="Check out --&gt;" data-via="JDP_911" data-size="large">Tweet</a>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
    Last edited by jddowell; 09-14-2013 at 09:25 PM. Reason: add link to my site

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,631
    Thanks
    0
    Thanked 649 Times in 639 Posts
    That code consists only of an inline element. It is the block element that you place it in that will need to be centred
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    jddowell (09-14-2013)


  •  

    Tags for this Thread

    Posting Permissions

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