Monday, 11 March 2019

HTML Share Buttons

First things first (although you may have thought it last), you need to style your buttons. Here is some pretty basic CSS code that will apply the default settings, best placed within your <head> tags (it’ll work just before the buttons though if you can only place it there). Obviously feel free to add to/amend any of this.
<style type="text/css">
#share-buttons img {
width: 35px;
padding: 5px;
border: 0;
box-shadow: 0;
display: inline;
view rawshare-buttons.css hosted with ❤ by GitHub
With your CSS in place, you then need to add the HTML script for the buttons…
<!-- I got these buttons from -->
<div id="share-buttons">
<!-- Buffer -->
<a href=";text=Simple Share Buttons" target="_blank">
<img src="" alt="Buffer" />
<!-- Digg -->
<a href="" target="_blank">
<img src="" alt="Digg" />
<!-- Email -->
<a href="mailto:?Subject=Simple Share Buttons&amp;Body=I%20saw%20this%20and%20thought%20of%20you!%20">
<img src="" alt="Email" />
<!-- Facebook -->
<a href="" target="_blank">
<img src="" alt="Facebook" />
<!-- Google+ -->
<a href="" target="_blank">
<img src="" alt="Google" />
<!-- LinkedIn -->
<a href=";url=" target="_blank">
<img src="" alt="LinkedIn" />
<!-- Pinterest -->
<a href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src',''+Math.random()*99999999);document.body.appendChild(e)%7D)());">
<img src="" alt="Pinterest" />
<!-- Print -->
<a href="javascript:;" onclick="window.print()">
<img src="" alt="Print" />
<!-- Reddit -->
<a href=";title=Simple Share Buttons" target="_blank">
<img src="" alt="Reddit" />
<!-- StumbleUpon-->
<a href=";title=Simple Share Buttons" target="_blank">
<img src="" alt="StumbleUpon" />
<!-- Tumblr-->
<a href=";title=Simple Share Buttons" target="_blank">
<img src="" alt="Tumblr" />
<!-- Twitter -->
<a href=";text=Simple%20Share%20Buttons&amp;hashtags=simplesharebuttons" target="_blank">
<img src="" alt="Twitter" />
<!-- VK -->
<a href="" target="_blank">
<img src="" alt="VK" />
<!-- Yummly -->
<a href=";title=Simple Share Buttons" target="_blank">
<img src="" alt="Yummly" />
That will get your share buttons up and running! You’ll be sharing this website though, so there’s still more to be done…
Start by changing all instances of ‘’ with the URL of the site/page you wish the buttons to act for.
Note that you will need to include the http:// or https:// for the links to be shared correctly. All share buttons, bar Pinterest, will need this changing.
Next, change the four instances of ‘Simple Share Buttons’ to the title of the page or website that the buttons will be displayed. These are present for the following share buttons:
  • Twitter
  • Reddit
  • StumbleUpon
  • Email
There are further customisable options available for some of these share buttons, but let’s keep things simple for now.
Last, but by no means least, the images. The HTML code above will use buttons located on this website, which you are more than welcome to use. The buttons will load more quickly however if you upload them and change the image sources accordingly.
You can download a zipped folder of the ones in this example here.

coding souce

No comments:

Post a Comment