让网页中所有链接都新开标签来打开

如何通过简单的代码设置,让你网页中的超链接都是用新页面标签来打开,而不用一个一个链接去修改?
网站建设在这里给你教一下非常简单的操作方法:
如果要在新选项卡中打开文档中的所有链接,则可以使用<base>element:
html代码<!– this link will open in a new tab. –>
<div class="wrapper">this link will be opened in a new tab:
<a href="https://freecodetools.org/">
free code tools
</a>read more:
<a href="https://developer.mozilla.org/en-us/docs/web/html/element/base">
mdn documentation
</a></div>
css代码/* please ❤ this if you like it! */
.wrapper {
text-align: center;
padding: 0 15px;
background-color: #173446;
color: white;
display: flex;
flex-direction: column;
height: 100vh;
justify-content: center;
align-items: center;
font-size: 1.4em;
}
a {
color: #999;
position: relative;
}
a:after {
background-color: #999;
bottom: 0;
content: "";
height: 1px;
left: 0;
position: absolute;
transform: scalex(0);
transition: all .3s ease-in-out 0s;
visibility: hidden;
width: 100%;
}
a:hover:after {
transform: scalex(1);
visibility: visible;
}
上一个:发展和管理 Facebook 群组的新方法
下一个:如何提高网站可用性
永丰网站建设,永丰做网站,永丰网站设计