🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# `spaceless` Use the `spaceless` tag to remove whitespace *between HTML tags*, notwhitespace within HTML tags or whitespace in plain text: <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4 5 6 7</pre></div></td><td class="code"><div class="highlight"><pre>{% spaceless %} &lt;div&gt; &lt;strong&gt;foo&lt;/strong&gt; &lt;/div&gt; {% endspaceless %} {# output will be &lt;div&gt;&lt;strong&gt;foo&lt;/strong&gt;&lt;/div&gt; #} </pre></div></td></tr></table> This tag is not meant to "optimize" the size of the generated HTML content butmerely to avoid extra whitespace between HTML tags to avoid browser renderingquirks under some circumstances. Tip If you want to optimize the size of the generated HTML content, gzipcompress the output instead. Tip If you want to create a tag that actually removes all extra whitespace inan HTML string, be warned that this is not as easy as it seems to be(think of `textarea` or `pre` tags for instance). Using a third-partylibrary like Tidy is probably a better idea. Tip For more information on whitespace control, read the[*dedicated section*](#) of the documentation and learn howyou can also use the whitespace control modifier on your tags.