Home >Web Front-end >HTML Tutorial >What to do if the html tag is invalid
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.
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; },
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;
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!