博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何嵌套HTML元素
阅读量:2504 次
发布时间:2019-05-11

本文共 2620 字,大约阅读时间需要 8 分钟。

This tutorial series will guide you through creating and further customizing 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 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 teach you how to nest HTML elements in order to apply multiple HTML tags to a single piece of content.

本教程将教您如何嵌套HTML元素,以便将多个HTML标签应用于单个内容。

HTML elements can be nested, meaning that one element can be placed inside another element. Nesting allows you to apply multiple HTML tags to a single piece of content. For example, try pasting the following code snippet inside your index.html file:

HTML元素可以嵌套 ,这意味着一个元素可以放在另一个元素内。 嵌套允许您将多个HTML标签应用于单个内容。 例如,尝试将以下代码片段粘贴到index.html文件中:

My bold text and my bold and emphasized text

Save your file and reload it in the browser. (For instructions on creating an index.html file, please see our or for loading the file in your browser, see our .) You should receive something like this:

保存文件,然后将其重新加载到浏览器中。 (有关创建index.html文件的说明,请参见的或有关如何在浏览器中加载文件的信息,请参见的 。)您应该收到类似以下内容的信息:

My bold text and my bold and emphasized text

我的粗体字以及我的粗体和强调文本

嵌套最佳做法 (Nesting Best Practices)

Note that it is recommended to always close nested tags in the reverse order that they were opened. For example, in the example below, the <em> tag closes first as it was the last tag to open. The <strong> tag closes last as it was the first to open.

请注意,建议始终以与打开嵌套标签相反的顺序关闭它们。 例如,在下面的示例中, <em>标签首先关闭,因为它是最后打开的标签。 <strong>标记是第一个打开的,因此最后关闭。

This sentence contains HTML elements that are nested according to best practices.

As a counter example, the following HTML code contains tags that are not nested according to best practices, as the <strong> tag closes before the <em> tag:

作为反例,以下HTML代码包含根据最佳实践嵌套的标记,因为<strong>标记 <em>标记之前关闭:

This sentence contains HTML elements that are not nested according to best practices.

While not technically necessary for rendering your HTML in the browser, nesting your tags in the proper order can help improve the readability of your HTML code for you or other developers.

尽管从技术上来说不需要在浏览器中呈现HTML,但按正确的顺序嵌套标签可以帮助您或其他开发人员提高HTML代码的可读性。

翻译自:

转载地址:http://giegb.baihongyu.com/

你可能感兴趣的文章
练习3.34
查看>>
oracle加减操作
查看>>
dp乱写3:环形区间dp(数字游戏)
查看>>
【Beta阶段】启程会议——第零次Scrum Meeting!
查看>>
Apple Tree
查看>>
JS 中对变量类型的五种判断方法
查看>>
学习进度十五
查看>>
解决Android Studio启动项目后一直处于refreshing 'View' gradle project,快速解决亲测有效...
查看>>
4.12 | 学习笔记
查看>>
python开发【第一篇】:基础知识
查看>>
javascript的window.onload()方法和jQuery的$(document).ready()的对比
查看>>
mysql数据库维护(备份和还原)和性能提高
查看>>
第八章 springboot + mybatis + 多数据源
查看>>
Arab and North African Region,2002(Snakes & ladders)
查看>>
React中的Refs
查看>>
自己使用MySQL中的GROUP_CONCAT(CONCAT_WS())函数查询的数据显示不全的问题. 以及在后台开发中怎么设置使用....
查看>>
Mysql强制修改密码
查看>>
100
查看>>
新手springmvc web简单搭建过程-caidachun
查看>>
Inline Edit
查看>>