How to implement line wrapping of html text? (code example)

藏色散人
Release: 2018-08-09 17:17:15
Original
11297 people have browsed it

Line wrapping in html is a simple function to implement, but for novices, they may not be able to remember it or have no idea how to start. So this article will briefly introduce to you how to implement HTML text line wrapping? Of course, there is a direct method that is to write paragraphs of text in the code. You can directly press Enter in the code to change the line. However, this type of line break is not recognized when rendering into a web page. If you really want to change the line, you can insert a tag into the paragraph of the code. to force a line break.

html text line wrapping specific code examples are as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>html文本换行测试</title>
</head>
<body>
<p>php中文网(php.cn)提供大量免费、原创、高清的php视频教程,<br />在学习的时候可以直接在线修改示例,<br />查看php执行效果是本站的一大特色,php从入门到精通,一站式php自学平台。</p>
</body>
</html>
Copy after login

The effect is as shown below:

How to implement line wrapping of html text? (code example)

Then this article shows Specific introduction to the actual test of HTML line wrapping code, I hope it will be helpful to friends in need!

Note:

1. All browsers support the html line break tag
tag.

2. Its definition and usage:


can insert a simple line break. The


tag is an empty tag (meaning it has no closing tag, so this is an error:
). In XHTML, place the closing tag within the opening tag, i.e.
. The


tag simply starts a new line, while the browser usually inserts some vertical spacing between adjacent paragraphs when it encounters a

tag.

3. Differences between HTML and XHTML

In HTML, the
tag has no closing tag.

In XHTML, the
tag must be closed correctly, like this:
.

The above is the detailed content of How to implement line wrapping of html text? (code example). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template