统计数字,空白符,制表符

There are a number of ways to insert spaces in HTML. The easiest way is by simply adding spaces or multiple   character entities before and after the target text. Of course, that isn't the DRYest method.

有多种方法可以在HTML中插入空格。 最简单的方法是简单地添加空格或多个  目标文本前后的字符实体。 当然,这不是DRYest方法。

Instead, to keep your code easy to maintain and reduce repetition, you can use the <span> and <pre> elements, along with a bit of CSS:

相反,为了使代码易于维护并减少重复,可以使用<span><pre>元素以及一些CSS:

使用<span>元素 (Using the <span> element)

An example of how to use <span> to control the spacing between text can be seen below:

下面是一个如何使用<span>来控制文本之间的间距的示例:

<p>Hello my name is <span class="tab"> James</p>

Note that <span> tags are self closing, meaning they do not need a />.

请注意, <span>标记是自动关闭的,这意味着它们不需要/>

Then you can use an external or internal styling to give the class tab some properties. For example, the following code will work in an external stylesheet:

然后,您可以使用外部或内部样式为class tab一些属性。 例如,以下代码将在外部样式表中运行:

.tab {padding-left: 2px;
}

You can also give the <span> some inline-style properties, as shown below.

您还可以为<span>一些内联样式的属性,如下所示。

Alternatively, you can give <span> the same properties as inline styles as shown below:

另外,您可以赋予<span>与内联样式相同的属性,如下所示:

<p>Hello my name is <span style="padding-left: 2px;"> James</p>

使用<pre>元素 (Using the <pre> element)

For an easy way to add a tab space, simply wrap your text in <pre> tags. For example:

为了方便地添加制表符空间,只需将文本包装在<pre>标记中。 例如:

The <pre> element simply represents preformated text. In other words, any spaces or tabs in the inner text will be rendered. For example:

<pre>元素仅表示预格式化的文本。 换句话说,将显示内部文本中的任何空格或制表符。 例如:

<pre>
function greeting() {console.log('Hello world!');
}
</pre>

Just keep in mind that any actual tab characters (not a bunch of spaces that look like tabs), that you use with this method might appear ridiculously wide. This is because the tab-size property for the <pre> element is set to 8 spaces by default.

请记住,此方法使用的任何实际的制表符(不是一堆看起来像制表符的空格)可能看起来都非常可笑。 这是因为<pre>元素的tab-size属性默认设置为8个空格。

You can change this with a bit of CSS:

您可以使用一些CSS进行更改:

pre {tab-width: 2;
}

有关HTML的更多信息: (More info about HTML:)

HyperText Markup Language (HTML) is a markup language used to construct online documents and is the foundation of most websites today.

超文本标记语言(HTML)是用于构造在线文档的标记语言,并且是当今大多数网站的基础。

A markup language like HTML allows us to

HTML之类的标记语言使我们能够

  • create links to other documents, 创建指向其他文档的链接,
  • structure the content in our document, and 整理文档中的内容,并
  • ascribe context and meaning to the content of our document.将上下文和含义赋予我们的文档内容。

An HTML document has two aspects to it. It contains structured information (Markup), and text-links (HyperText) to other documents.

HTML文档有两个方面。 它包含结构化信息(标记)和指向其他文档的文本链接(超文本)。

We structure our pages using HTML elements. They are constructs of the language providing structure and meaning in our document for the browser and the element links to other documents across the internet.

我们使用HTML元素构造页面。 它们是语言的结构 ,在浏览器的文档中提供了结构和含义 ,并且该元素链接了整个互联网上的其他文档。

The internet was originally created to store and present static (unchanging) documents. The aspects of HTML discussed above were seen perfectly in these documents which lacked all design and styling. They presented structured information that contained links to other documents.

互联网最初是用来存储和呈现静态(不变)文档的。 在缺少所有设计和样式的这些文档中,可以完美地看到上面讨论HTML方面。 他们介绍了结构化信息,其中包含指向其他文档的链接。

HTML5 is the latest version, or specification, of HTML. The World Wide Web Consortium (W3C) is the organization that develops the standards for the World Wide Web, including those for HTML. As web pages and web apps grow more complex, W3C updates HTML’s standards.

HTML5是HTML的最新版本或规范。 万维网联盟(W3C)是开发万维网标准(包括HTML标准)的组织。 随着网页和Web应用程序变得越来越复杂,W3C更新了HTML的标准。

HTML5 introduces a whole bunch of semantic elements. While HTML helps provide meaning to our document, it wasn’t until the introduction of semantic elements with HTML5 that its potential was fully known.

HTML5引入了很多语义元素。 尽管HTML有助于为我们的文档提供含义,但直到HTML5引入语义元素后,它的潜力才被人们充分认识。

HTML文档的简单示例 (A simple example of an HTML Document)

<!DOCTYPE html>
<html>
<head><title>Page Title</title>
</head>
<body><h1>My First Heading</h1><p>My first paragraph.</p></body>
</html>

!DOCTYPE html: Defines this document to be HTML5

!DOCTYPE html:将此文档定义为HTML5

html: The root element of an HTML page

html:HTML页面的根元素

head: The element contains meta information about the document

head:元素包含有关文档的元信息

title: The element specifies a title for the document

title:元素指定文档的标题

body: The element contains the visible page content

正文:该元素包含可见的页面内容

h1: The element defines a large heading

h1:元素定义大标题

p: The element defines a paragraph

p:元素定义一个段落

HTML版本 (HTML Versions)

Since the early days of the web, there have been many versions of HTML

自网络初期以来,已经有许多版本HTML

  • HTML1991HTML1991
  • HTML 2.01995HTML 2.01995
  • HTML 3.21997HTML 3.21997
  • HTML 4.011999XHTML 4.011999X
  • HTML2000HTML2000
  • HTML52014HTML52014

其他资源 (Other Resources)

  • HTML Elements

    HTML元素

  • Semantic HTML

    语义HTML

  • HTML Attributes

    HTML属性

翻译自: https://www.freecodecamp.org/news/tab-space-instead-of-multiple-non-breaking-spaces/

统计数字,空白符,制表符

统计数字,空白符,制表符_为什么您应该在HTML中使用制表符空间而不是多个非空白空间(nbsp)...相关推荐

  1. python中水平制表符_打印格式化与字符串之水平间隔—制表符,,

    打印格式化与字符串之水平间隔-制表符,, 水平间隔-制表符 我们刚才看到了如何控垂直间隔(通过增加换行,或者使用逗号来避免换行).现在我们来看如何利用制表符控制屏幕上内容的水平间隔. 制表符(Tab, ...

  2. python横向制表符_零基础学python_03_字符串(拼接+换行+制表符)

    字符串拼接 在编码的过程很多时候都会用到字符串的拼接,例如,你可能想将姓和名存储在不同的变量中,等要显示姓名时再将它们合而为一: first_name = "li" last_na ...

  3. alt+数字 符号大全_【BIM工具箱】Revit中特殊符号大全和输入技巧

    Revit在出图或创建族文件的过程中,经常需要输入一些特殊符号(比如:角度.正负号.立方.平方等),很多人不知道要如何输入这些符号.这些符号可以通过键盘上的AIT键+数字小键盘实现,按住键盘ALT按键 ...

  4. java 有序列表_关于算法:在Java中为列表列表生成唯一的有序非重复组合

    我知道有很多类似的问题,并且已经阅读了几个小时.但是它们似乎都不符合我的要求. 我有列表列表(list >),列表可以是任何大小. 例: 我的外部列表大小是:4 清单内容 1. list(0) ...

  5. Linux shell输出制表符,关于bash:如何在终端中打印制表符分隔文件

    我将excel数据导出到制表符分隔的txt文件中,但是我很难在终端中打印它,这是文件: heading1    heading2    heading3    heading4    heading5 ...

  6. 预处理器命令必须作为第一个非空白空间启动_第三章 图形处理器(上)

    "The display is the computer." --Jen-Hsun Huang 历史上,图形加速始于在与三角形重叠的每个像素扫描线上对颜色插值,然后显示这些值.包括 ...

  7. 算法设计原则验证实验报告_算法设计与分析实验报告 统计数字问题

    一 . 实验要求 1 .掌握算法的计算复杂性概念. 2 .掌握算法渐近复杂性的数学表述. 3 .掌握用 C++ 语言描述算法的方法. 4 .实现具体的编程与上机实验,验证算法的时间复杂性函数. 二 . ...

  8. java常用的统计_(OJ)Java常用类-统计数字次数

    统计数字次数 Problem Description 命令行输入一个由数字组成的任意字符串,统计出每个数字出现的次数. Input Description 1239586838 Output Desc ...

  9. 6-4 使用函数统计指定数字的个数_高手不可不学的Excel引用函数(上)

    玩转Excel,不会引用函数怎么行? 高手常用12大引用函数,今天就来学4个,让2019年有个好开端. 1.使用ADDRESS函数返回指定行号和列号对应的单元格地址 ADDRESS函数用于在给出指定行 ...

最新文章

  1. php mysql log文件怎么打开_如何查看mysql的日志文件
  2. Toast的功能和用法
  3. VTK:图表之ConstructTree
  4. 高低层特征融合【转载】
  5. Matplotlib - bar(条形图)
  6. action support分析
  7. BootStrap--dropdown
  8. linux 查看设备 usb设备驱动程序,Linux USB设备驱动程序未被探测
  9. windows操作系统与linux操作系统相比各有什么优缺点
  10. 如何把图纸转换为t3格式_天正cad转t3格式
  11. qt html字体变红,QLineEdit、QLabel字体大小、颜色设置
  12. thingsboard往kafka推送数据
  13. C语言 —— 多维数组
  14. 翻译谷歌浏览器F12的功能
  15. 程序员保持健康的生活指南
  16. Protege 使用教程(详细讲解 入门简单易懂)
  17. 密立根油滴实验数据处理,油滴电荷量计算,简单复制即可用
  18. 无法登录到你的账户解决方案
  19. Mac(OSX)下媲美XShell的神器Termius
  20. CS224W-图神经网络 笔记3.2:Motifs and Structural Roles in Networks - 网络的结构(Structural Roles)

热门文章

  1. 【java】暑期需要复习的操作
  2. 微信公众号开发 微信消息回复开发 文本消息 图片消息开发
  3. python3 线程池源码解析_5分钟看懂系列:Python 线程池原理及实现
  4. python爬虫案例_推荐上百个github上Python爬虫案例
  5. 微信小程序自定义轮播图滚动样式 自定义组件轮播图的实现
  6. 微信小程序插件新增能力
  7. 自动布局按钮排列平均分布
  8. Git 中常用的 4 个命令
  9. 怎么获得combobox的valueField值
  10. Angular开山篇