natasha pubresa
natasha pubresa

Reputation: 1

Why do links to social media do not work using html?

I have the following code in my html. When I click on the icon I want to be taken to my websites facebook account.

     <li><a href="www.facebook.com/mywebsitename"><i class="fa fa-facebook" aria- 
      hidden="true"></i></a></li>

However instead I get my webpage without any css and the url changes to the following url. Why is this?

      https://mywebiste.com/www.facebook.com/mywebsite

Upvotes: 0

Views: 324

Answers (3)

Ann Soboleva
Ann Soboleva

Reputation: 11

This happens because you didn't write the beginning of the line address. He directs you to your own page in this project because he doesn't know where to go. Use https://.

<a href="https://www.facebook.com/mywebsitename">

Upvotes: 1

Kosh
Kosh

Reputation: 18413

Your URL should be starting with a scheme:
<a href="https://www.facebook.com/mywebsitename">

See more here: What_is_a_URL

Upvotes: 1

K-Galalem
K-Galalem

Reputation: 320

The URL is considered as a directory Path. try to replace

href="www.facebook.com/mywebsitename"

to

href="https://www.facebook.com/mywebsitename"

Upvotes: 3

Related Questions