Taylor Styles Taylor Styles - 7 months ago 36
HTML Question

Href while running localhost not working

so im designing a website using html, php, all that fun stuff & im trying to make facebook, twitter, youtube & instagram links that will open a new tab and take you to the website. but at the moment the URL is going to

localhost/horizonphotography/www.facebook.com
instead of opening the new tab and THEN going to www.facebook.com.

heres my HTML

`<div class="social">
<a href="www.facebook.com" target="_blank">
<img border="0" alt="Facebook" src="img/facebook.png" width="50" height="50">
</a>

<a href="www.twitter.com" target="_blank">
<img border="0" alt="twitter" src="img/twitter.png" width="50" height="50">
</a>

<a href="www.youtube.com" target="_blank">
<img border="0" alt="youtube" src="img/youtube.png" width="50" height="50">
</a>

<a href="www.instagram.com" target="_blank">
<img border="0" alt="instagram" src="img/instagram.png" width="50" height="50">
</a>
</div> `


and my css 'if' required.

.social {
position: fixed;
bottom: 0;
right: 7%;
width: 300px;


}

thanks in advance!

Answer

Try using a protocol like http:// or // to external links like this :

<a href="http://www.facebook.com" target="_blank">
<img border="0" alt="Facebook" src="img/facebook.png" width="50" height="50">
</a>

See this good answer on SO : http://stackoverflow.com/a/8951636/6028607