Home  >  Article  >  Web Front-end  >  What is the role of pre tag

What is the role of pre tag

云罗郡主
云罗郡主Original
2019-02-16 11:58:2021702browse

pre标签的作用是什么?

pre 元素可定义预格式化的文本。被包围在 pre 元素中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体,最常见应用就是用来表示计算机的源代码。

作用:定义预格式化的文本。

说明:被包围在 pre 元素中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体。e03b848252eb9375d56be284e690e873 标签的一个常见应用就是用来表示计算机的源代码。可以导致段落断开的标签(例如标题、e388a4556c0f65e1904146cc1a846bee 和 208700f394e4cf40a7aa505373e0130b 标签)绝不能包含在 e03b848252eb9375d56be284e690e873 所定义的块里。尽管有些浏览器会把段落结束标签解释为简单地换行,但是这种行为在所有浏览器上并不都是一样的。pre 元素中允许的文本可以包括物理样式和基于内容的样式变化,还有链接、图像和水平分隔线。

注释:如果您希望使用 e03b848252eb9375d56be284e690e873 标签来定义计算机源代码,比如 HTML 源代码,请使用符号实体来表示特殊字符,比如 "<" 代表 "7d580d702c39244e93a07ae109a93e60","&" 代表 "&"。

html pre标签 示例


  

  
    离离原上草,一岁一枯荣。
    野火烧不尽,春风吹又生。
  

可以看到上面我们没有做任何的CSS渲染,文字依然按照我们排列好的形式格式化输出


The above is the detailed content of What is the role of pre tag. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn