'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


Solution 1:[1]

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

href="www.facebook.com/mywebsitename"

to

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

Solution 2:[2]

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

See more here: What_is_a_URL

Solution 3:[3]

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">

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 K-Galalem
Solution 2 Kosh
Solution 3 Ann Soboleva