<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Random Musings of a Code Monkey &#187; Google+</title>
	<atom:link href="http://www.tinyblueplanet.com/code/?cat=21&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.tinyblueplanet.com/code</link>
	<description>Little bits of technology all broken down</description>
	<lastBuildDate>Wed, 07 Dec 2011 08:29:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Google+ buttons failing on HTML 4.01</title>
		<link>http://www.tinyblueplanet.com/code/?p=37</link>
		<comments>http://www.tinyblueplanet.com/code/?p=37#comments</comments>
		<pubDate>Mon, 14 Nov 2011 13:30:55 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Google+]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.tinyblueplanet.com/code/?p=37</guid>
		<description><![CDATA[Getting Google+ buttons to play nice with HTML 4.01 One of the first things I was asked to do after being away for a bit was to link in Google+ to a friends website. The website is all HTML 4.01 &#8230;<p class="read-more"><a href="http://www.tinyblueplanet.com/code/?p=37">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<h1>Getting Google+ buttons to play nice with HTML 4.01</h1>
<p>One of the first things I was asked to do after being away for a bit was to link in Google+ to a friends website. The website is all HTML 4.01 and will probably stay that way until HTML 5.0 is finalized and widely supported.</p>
<p>So I headed to the <a title="Google+ button generator" href="http://www.google.com/webmasters/+1/button/">Google+ button generator</a> to link in the button but oddly it fails to produce code that is legal for HTML 4.01 (or XHTML 1.0).</p>
<p>It took a little playing around to work out how to fix this and just in case you&#8217;re interested its simply a matter of:</p>
<p>1. Adding the Google+ javascript code into your header</p>
<pre>&lt;script type="text/javascript" src="https://apis.google.com/js/plusone.js"&gt; {"parsetags": "explicit"}%lt;/script&gt;</pre>
<p>2. Create the place where you want to render the button</p>
<pre>&lt;div id="plusone"&gt;&lt;/div&gt;</pre>
<p>Note: you can&#8217;t set any attributes here because HTML 4.01 doesn&#8217;t allow them, so you must set them in the javascript.</p>
<p>3. Call the google+ render function to draw the button.</p>
<pre>&lt;script type="text/javascript"&gt;gapi.plusone.render("plusone", { "size": "medium", "count": "false" });&lt;/script&gt;</pre>
<p>We use that CSS id <em>plusone</em> from (2) to tell the Google+ javascript where to render. As I&#8217;m also lazy I&#8217;m creating the simplest button without any label. You can look at the Google+ javascript reference to see how to set things up explicitly.</p>
<h2>Placing the Button</h2>
<p>Visually aligning this button was also somewhat puzzling at first because Google+ stylesheet sets all the margins and paddings to zero. To solve this I simply wrapped the button in another div and used the following CSS to enable me to line it up with the other social media buttons:</p>
<pre>#plusonewrapper{vertical-align: -30%; padding-left: 5px; display: inline-block; height: 24px;}</pre>
<p>Again I&#8217;m being a little lazy here and just played with the vertical alignment to get things to line up.</p>
<p>Easy! But weird that Google doesn&#8217;t do this for you. Other social media sites make it very very easy esp as now I need to test this on a variety of browsers to see if it works, which is a bit of a pain (so far just tested on Chrome, Firefox and Safari).</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinyblueplanet.com/code/?feed=rss2&#038;p=37</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
