How to insert posts / tweets from your Twitter account onto your website.

Posted 25 Sep 2009 - No Comments - leave yours now!

Every time you post a new tweet to your Twitter account it will automatically appear on your website, allowing you to make minor updates to your website on the move or post messages to your audience which are too small for a regular blog post (aka micro blogging). The process is very simple but a basic understanding of html and css is very helpful especially in controlling the look of your post.

View the example | download the demo html & screenshots

The really, really easy bit.

twitter tut - screenshot 1

Next page… here you will see the options for adding twitter to various apps in this case I will ignore any option that isn’t relevant

twitter tut - screenshot 2

Next page… here you also have the option to add a flash widget to your site, we’re not interested in that on this occasion as we want to style our tweets to our liking which means using html/css

twitter tut - screenshot 3

Next page…

twitter tutorial - screenshot 4

That bit was ridiculously easy, right? – here’s the bit you might be a little scared of if you’re not familiar with html/css.

The next thing we need to do is to paste the code we’ve just copied into our webpage. Here’s a very basic page I made earlier.

twitter tutorial - screenshot 5

code1

Most likely you would want your Tweets to appear in your websites sidebar, which is where we will place them in this tutorial.

code2

code3

Now lets check how that looks in a browser… (open your html in firefox/safari/opera… or if you really must internet explorer)

twitter tutorial - screenshot 6

Woohoo, now you can see our Tweets appearing in our sidebar. They do however look a little messy… we can change this with css.

Because we already have an unordered list (<ul>…</ul>) in our page which we are happy with the look of we need to target our Tweets ul (unordered list) independently. In the code we copied from Twitter our ul (unordered list) already has a unique id “twitter_update_list” which we can refer to in our css, we’ll then refer to our list items (<li>) within that list.

twitter tutorial - screenshot 7

Admitedly the above is still not asthetically pleasing but works well enough as an example in this case – here’s the css I have used to style our Tweets… (you can obviously style your own to suit)

ul#twitter_update_list {list-style-type:none; padding:0;}   /* this refers to our unordered list */

ul#twitter_update_list li {font-size:1.2em; line-height:1.2em; margin:0 0 10px 0; font-weight:bold;}   /* this refers to our list items within our unordered list */

ul#twitter_update_list li a {color:#666666; font-weight:normal; text-decoration:none;}   /* refers to links within our list items */

ul#twitter_update_list li a:hover {border-bottom:dotted 1px #f58428;}   /* hover effect for our links */

The only bit left to style is our “follow me on Twitter” link at the bottom of our tweets. In the code we pasted into our page this link was styled using inline styles, although it still had its own presodo selecor (id) so we can remove the inline styles and target the link in the head of our page instead (or your external stylesheet on your own site).

So in this case I have inserted the following into the css and removed the inline style from my html.

/*style the follow us on twitter link */

#twitter-link {float:right; color:#f58428; text-decoration:none; border-bottom:dotted 1px #f58428;}

tt8

andy-1Andy Kleeman is a graphic designer and web developer (aka the boy who cried fox) living in Camberley Surrey, you can see his website here.
“Thanks to Ken for including this post!”

If you enjoyed this post why not sign up to get automatic email updates whenever I post something new?
Subscribe to email updatesSubscribe to my RSS feed
Follow me on twitterJoin me on Facebook

- leave a comment!
 

There are no comments yet, add one below.

Leave a Comment






Who's Ken?

Picture of Ken I'm a freelance graphic designer living and working in Suffolk. I've been using Illustrator, Photoshop, InDesign & Quark Xpress since 1999 but I've been using pens, pencils, paper and most importantly my imagination for a lot longer. I'm always looking for new clients to work with and interesting projects to work on.

Recent Articles

Categories

RSS Feed Email Subscription Follow me on Twitter Join me on Facebook

Recent Tweets

Archives

Friends & Sites of Interest


© Ken Reynolds Design
footer navigation