Home > Web Front-end > HTML Tutorial > What to do if the html tag is invalid

What to do if the html tag is invalid

醉折花枝作酒筹
Release: 2023-01-06 11:16:55
Original
3242 people have browsed it

Solution: 1. Assign the innerText of the element to the innerHTML of the element; 2. For line breaks similar to carriage returns, use "word-break:break-all;word-wrap:break-word;white-space" :pre-line;" style to render.

What to do if the html tag is invalid

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

1) Assign the innerText of the element to the innerHTML of the element. This can avoid escaping problems and make the HTML tags contained in the string effective.

<div ref="introContent" class="intro__content">{{intro}}</div>

mounted() {
        // let text = this.$refs.introContent.innerText;
        // this.$refs.introContent.innerHTML = text;
    },
Copy after login

2) Line breaks similar to carriage returns, using styles to present line breaks

word-break: break-all;
word-wrap: break-word;
white-space: pre-line;
Copy after login

Recommended learning: html video tutorial

The above is the detailed content of What to do if the html tag is invalid. 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