ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# `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.