In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "how to solve Golang in Web development front-end inexplicable blank line wrap", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to solve Golang in Web development front-end inexplicable blank line wrap" this article.
Question:
When using Golang for Web development, sometimes the rendered template will appear some strange blank line breaks when it is displayed in the foreground, which is characterized by the fact that there is no white space defined in the css stylesheet.
Analysis:
Look at the source code of the page in question, copy the blank line feed and transcode it to Unicode, and find that it contains characters such as\ u2028 [figure 1].
[figure 1]
In addition, if you select Edit as html directly in the html in the browser check, you can also find that there is a small red dot in the blank space, and the mouse movement will directly show that the character is\ u2028 [figure 2]. Looking up the data, we found that such newline characters are not supported in JavaScript.
[figure 2]
Solution:
It can be found on the web page that the problem can be solved by deleting these little red dots directly. There is a direct front-end processing method on the Internet, that is, you can search for\ u2028 on the page and replace it with\ u2028. Of course, you can also use Golang to process it in the background, that is, to retrieve and replace the content before outputting html.
Strings.Replace (html, "\ u2028", "- 1) the above are all the contents of this article entitled" how to solve the inexplicable blank line wrapping in the front end of Golang in Web development ". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.