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

What to do if the html tag is invalid

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-06-09 10:46:413243browse

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;
    },

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!

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
Previous article:What is float in htmlNext article:What is float in html