html中p元素添加超链接_如何在HTML中添加超链接

html中p元素添加超链接

How To Build a Website With HTML 如何使用HTML构建网站

This tutorial series will guide you through creating and further customizing this website using HTML, the standard markup language used to display documents in a web browser. No prior coding experience is necessary but we recommend you start at the beginning of the series if you wish to recreate the demonstration website.

本教程系列将指导您使用HTML(用于在Web浏览器中显示文档的标准标记语言)创建和进一步自定义此网站 。 不需要任何编码经验,但是如果您希望重新创建演示网站,建议您从本系列开头开始

At the end of this series, you should have a website ready to deploy to the cloud and a basic familiarity with HTML. Knowing how to write HTML will provide a strong foundation for learning additional front-end web development skills, such as CSS and JavaScript.

在本系列的最后,您应该拥有一个可以部署到云的网站,并且对HTML有了基本的了解。 知道如何编写HTML将为学习其他前端Web开发技能(例如CSS和JavaScript)奠定坚实的基础。

This tutorial will walk you through the steps of adding hyperlinks to your webpage.

本教程将引导您完成将超链接添加到网页的步骤。

Hyperlinks can be added to text or images with the anchor link element <a>. The <a> tag requires the attribute href, which is used to specify the destination link. The <a> element is used like this:

可以使用锚链接元素<a>链接添加到文本或图像。 <a>标记需要属性href ,该属性用于指定目标链接。 <a>元素的用法如下:

<a href="www.DestinationLink.com">The text you want to link</a>

Try adding the code snippet below to your “index.html” file and changing the sample highlighted text with a real link, such as https://digitalocean.com/community:

尝试将以下代码片段添加到“ index.html”文件中,并使用真实链接(例如https://digitalocean.com/community更改示例突出显示的文本:

<a href="https://www.digitalocean.com/community">The text you want to link</a>

(If you have not been following the tutorial series, you can review instructions for setting up an index.html file in our tutorial Setting Up Your HTML Project. Save the file and load it in your browser.

(如果您还没有按照本教程系列进行操作,则可以在我们的教程“ 设置HTML项目”中查看有关设置index.html文件的说明。保存该文件并将其加载到浏览器中。

You should receive an output like this:

您应该收到如下输出:

You can also link images by wrapping an image element with an <a> element like so:

您还可以通过将图像元素包装为<a>元素来链接图像,如下所示:

<a href="https://www.digitalocean.com/community">The text you want to link
<img src="https://html.sammy-codes.com/images/small-profile.jpeg">
</a>

Try testing the code snippet in your browser to check that it works. You should now understand how to add hyperlinks to text and images on your webpage.

尝试在浏览器中测试代码段,以检查其是否有效。 现在,您应该了解如何在网页上向文本和图像添加超链接。

翻译自: https://www.digitalocean.com/community/tutorials/how-to-add-hyperlinks-in-html

html中p元素添加超链接

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值