| | #1 |
| Internet Marketing War Room Member Join Date: 2011 Location: Gulf Shores, AL
Posts: 52
Thanks: 31
Thanked 7 Times in 7 Posts
Blog Entries: 2 |
I want to center the widget (code) below. Where do I put the code to center it? Can someone put it in there and hi-lite it so I can see and be able to do it myself next time? ![]() <a class="twitter-timeline" href="https://twitter.com/Domainvertize" data-widget-id="305574601449144320">Tweets by @Domainvertize</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);j s.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs); } } (document,"script","twitter-wjs");</script> |
| | |
| |
| | #2 |
| Warrior Member Registered Member Join Date: 2013 Location: USA
Posts: 28
Thanks: 15
Thanked 7 Times in 6 Posts
|
You need to wrap it in a div & give that div a class, like this: <div class="center"> <a class="twitter-timeline" href="https://twitter.com/Domainvertize" data-widget-id="305574601449144320">Tweets by @Domainvertize</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);j s.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs); } } (document,"script","twitter-wjs");</script> </div> then you need to add the rule to the CSS file as follows: div.center { width: (whatever the width of the element is); margin: 0 auto; /*this is what centers the element*/ } You need to specify a width or it won't center. This is the correct way of doing it using current standards. Now, if you want to add it directly to the html it is as follows . <a align="center" class="twitter-timeline" href="https://twitter.com/Domainvertize" data-widget-id="305574601449144320">Tweets by @Domainvertize</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);j s.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs); } } (document,"script","twitter-wjs");</script> or.... <a style="margin: 0 auto; width: 890px;" class="twitter-timeline" href="https://twitter.com/Domainvertize" data-widget-id="305574601449144320">Tweets by @Domainvertize</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);j s.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs); } } (document,"script","twitter-wjs");</script> Modify the width in the second example to reflect how wide you need it to be. Hope that helps, Pandita |
| | |
| |
| | #3 |
| HyperActive Warrior War Room Member Join Date: 2010 Location: England
Posts: 403
Thanks: 152
Thanked 386 Times in 269 Posts
|
I'd normally just do this: <div align="center"> <a class="twitter-timeline" href="https://twitter.com/Domainvertize" data-widget-id="305574601449144320">Tweets by @Domainvertize</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);j s.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs); } } (document,"script","twitter-wjs");</script> </div> |
| |
| | #4 |
| Senior Warrior Member War Room Member Join Date: 2011
Posts: 1,841
Thanks: 904
Thanked 846 Times in 581 Posts
|
Or you can skip all of the extra nonsense posted above, and use this: <center> your widget stuff here </center> LOL why do people like to make things harder than they actually are? So for your specific example, this would be it centered: <center><a class="twitter-timeline" href="https://twitter.com/Domainvertize" data-widget-id="305574601449144320">Tweets by @Domainvertize</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);j s.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs); } } (document,"script","twitter-wjs");</script></center> |
| | |
| |
| | #5 | |
| Warrior Member Registered Member Join Date: 2013 Location: USA
Posts: 28
Thanks: 15
Thanked 7 Times in 6 Posts
|
| |
| | ||
| |
| | #6 | |
| Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 236
Thanked 1,377 Times in 676 Posts
|
Pandita gave a pretty good solution... the only thing I would add to it is 'text-align: center', to account for older IE browsers. HTML Code: .center {
width: (whatever the width of the element is);
margin: 0 auto; /*this is what centers the element*/
text-align: center;
} | |
| | ||
| |
| | #7 |
| Mad For Money Making Join Date: 2011 Location: UK
Posts: 454
Thanks: 11
Thanked 48 Times in 46 Posts
|
To center something in HTML the code is < center> </ center> (remove the spaces)
|
| | |
| |
| | #8 | |
| Senior Warrior Member War Room Member Join Date: 2011
Posts: 1,841
Thanks: 904
Thanked 846 Times in 581 Posts
|
| |
| | ||
| |
| | #9 |
| Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 236
Thanked 1,377 Times in 676 Posts
| |
| | |
| |
| | #10 |
| HyperActive Warrior War Room Member Join Date: 2009
Posts: 178
Thanks: 60
Thanked 33 Times in 33 Posts
|
Why is this <center> tag still being forced in this thread? The first 2 replies posted by Pandita and Alistair should have settled the OP's problem. Here comes the 'elders' who've been living in caves for the past 12 years or so who wants to flaunt their skills with the <center> tags. LOL!
|
| |
|
| Bookmarks |
| Tags |
| center, code, html |
| |