忽略HTML中的空格[重複] - Ignore whitespace in HTML [duplicate]

問題:

This question already has an answer here: 這個問題在這裏已有答案:

Is there anything in HTML/CSS that tells the browser to ignore whitespace completely? HTML / CSS中是否有任何東西告訴瀏覽器完全忽略空格?

So many times when you want to put, say, two images next to each other - you try desperately to keep the HTML readable, but the browser puts a space between them. 很多時候你想把兩個圖像放在一起 - 你拼命想讓HTML保持可讀性,但是瀏覽器會在它們之間留一個空格。

So instead of something like this: 所以不要這樣:

<img src="images/minithing.jpg" alt="my mini thing" />
<img src="images/minithing.jpg" alt="my mini thing" />
<img src="images/minithing.jpg" alt="my mini thing" />
<img src="images/minithing.jpg" alt="my mini thing" />

you end up with this 你最終得到了這個

<img src="images/minithing.jpg" alt="my mini thing" /><img src="images/minithing.jpg" alt="my mini thing" /><img src="images/minithing.jpg" alt="my mini thing" /><img src="images/minithing.jpg" alt="my mini thing" />

Which is just so horrible! 哪個太可怕了!


解決方案:

參考一: https://stackoom.com/question/B1fu
參考二: Ignore whitespace in HTML [duplicate]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章