运行localhost时Href不工作



所以我使用html、php、所有这些有趣的东西来设计一个网站&我试图制作脸书,推特,youtube&instagram链接,将打开一个新的选项卡并将您带到网站。但此时URL将转到CCD_ 1,而不是打开新标签然后转到www.facebook.com

这是我的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> 

和我的css"if"是必需的。

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

提前感谢!

尝试使用像http:////这样的协议到外部链接,如下所示:

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

在SO上看到这个好答案:https://stackoverflow.com/a/8951636/6028607

您需要指定协议,或者将//放在href属性的开头。例如:

http://www.youtube.com

//www.youtube.com

太棒了,需要按照建议识别协议。现在工作得很好!谢谢大家!

最新更新