2

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!

Uttam Kumar Roy
  • 2,060
  • 4
  • 23
  • 29
Taylor Styles
  • 139
  • 1
  • 13

3 Answers3

6

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 : https://stackoverflow.com/a/8951636/6028607

Community
  • 1
  • 1
Vincent G
  • 8,547
  • 1
  • 18
  • 36
2

You need to specify the protocol, or put // at the start of the href attribute. For example:

http://www.youtube.com

Or

//www.youtube.com

Richard Guy
  • 470
  • 4
  • 12
0

Awesome, needed to identify the protocol as suggested. working well now! thanks everyone!

Taylor Styles
  • 139
  • 1
  • 13