html a标签传值_HTML`a`标签

html a标签传值

Links are defined using the a tag. The link destination is set via its href attribute.

链接是使用a标签定义的。 链接目标是通过其href属性设置的。

Example:

例:

<a href="https://flaviocopes.com">click here</a>

Between the starting and closing tag we have the link text.

在开始标记和结束标记之间,我们有链接文本。

The above example is an absolute URL. Links also work with relative URLs:

上面的示例是绝对URL。 链接也可以使用相对URL:

<a href="/test">click here</a>

In this case, when clicking the link the user is moved to the /test URL on the current origin.

在这种情况下,单击链接时,用户将移动到当前来源的/test URL。

Be careful with the / character. If omitted, instead of starting from the origin, the browser will just add the test string to the current URL.

请注意/字符。 如果省略,则浏览器将代替将test字符串添加到当前URL,而不是从起点开始。

Example, I’m on the page https://flaviocopes.com/axios/ and I have these links:

例如,我在页面https://flaviocopes.com/axios/ ,我具有以下链接:

  • /test once clicked brings me to https://flaviocopes.com/test

    /test一次单击即可将我带到https://flaviocopes.com/test

  • test once clicked brings me to https://flaviocopes.com/axios/test

    单击一次test即可将我带到https://flaviocopes.com/axios/test

Link tags can include other things inside them, not just text. For example, images:

链接标签可以在其中包含其他内容,而不仅仅是文本。 例如,图像:

<a href="https://flaviocopes.com">
	<img src="test.jpg">
</a>

or any other elements, except other <a> tags.

或其他任何元素,但其他<a>标记除外。

If you want to open the link in a new tab, you can use the target attribute:

如果要在新选项卡中打开链接,则可以使用target属性:

<a href="https://flaviocopes.com" target="_blank">open in new tab</a>

翻译自: https://flaviocopes.com/html-links/

html a标签传值

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值