Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Social sharing buttons invalidate XHTML

I've written valid XHTML 1.0 Transitional Code. I want to add social sharing buttons (twitter, facebook and google+), but all of these buttons invalidate my code. Is there any solution available?

like image 653
billa Avatar asked Dec 30 '25 20:12

billa


1 Answers

Many articles on this topic of whether valid html is important. The majority say it isn't and I'm going to completely disagree with them. I have brought sites up to front pages of google just by validating the code and trying (as much as possible) to have the indentation formated. But as I say more disagree with me than agree.

So when I used the social media buttons I found one that will validate. I used the "share this" system and deleted the 'displayText' attribute for each span. This means that the alt text (tooltip) when you hover the icon won't show. But if someone has an account with that social media then they will prob recognise the icon anyways. http://sharethis.com/

So the code that they say to use is:

    <span class='st_stumbleupon_large' displayText='StumbleUpon'></span>
    <span class='st_digg_large' displayText='Digg'></span>
    <span class='st_pinterest_large' displayText='Pinterest'></span>
    <span class='st_facebook_large' displayText='Facebook'></span>
    <span class='st_twitter_large' displayText='Tweet'></span>
    <span class='st_sharethis_large' displayText='ShareThis'></span>
    <span class='st_email_large' displayText='Email'></span>

and i changed it to:

    <span class='st_stumbleupon_large'></span>
    <span class='st_digg_large'></span>
    <span class='st_pinterest_large'></span>
    <span class='st_facebook_large'></span>
    <span class='st_twitter_large'></span>
    <span class='st_sharethis_large'></span>
    <span class='st_email_large'></span>

and now validates to xHTML (should work for html5) as well.

like image 53
Daithí Avatar answered Jan 02 '26 10:01

Daithí



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!