<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>html &#8211; 小豬日常</title>
	<atom:link href="https://piglife.tw/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>https://piglife.tw</link>
	<description>Hello World，一個紀錄生活與學習的地方</description>
	<lastBuildDate>Fri, 12 Dec 2025 14:45:37 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://piglife.tw/wp-content/uploads/2017/10/cropped-logo-1-32x32.png</url>
	<title>html &#8211; 小豬日常</title>
	<link>https://piglife.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>去除 HTML img 標籤多餘空格白線的技術筆記</title>
		<link>https://piglife.tw/technical-notes/remove-html-img-white-space/</link>
					<comments>https://piglife.tw/technical-notes/remove-html-img-white-space/#respond</comments>
		
		<dc:creator><![CDATA[小豬]]></dc:creator>
		<pubDate>Tue, 21 Nov 2017 08:15:52 +0000</pubDate>
				<category><![CDATA[技術筆記]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[display-block]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[img標籤]]></category>
		<category><![CDATA[圖片拼接]]></category>
		<category><![CDATA[空白白線]]></category>
		<guid isPermaLink="false">https://piglife.tw/?p=282</guid>

					<description><![CDATA[說明如何解決 HTML img 標籤在並排時產生的多餘空白白線問題，透過設定 display:blo...]]></description>
										<content:encoded><![CDATA[<h2 class="wp-block-heading">前言</h2>
<p>在網頁設計或 EDM 製作中，常會遇到將多張圖片並排時，中間出現不必要的空白白線問題。這種白線通常是因為圖片元素的默認行內行為導致的空格，對於需要精確拼接圖片的場景非常困擾。</p>
<h2 class="wp-block-heading">問題說明</h2>
<p>當兩個 <code>&lt;img&gt;</code> 標籤並排時，瀏覽器會將它們視為行內元素，並在圖片間插入空白字元，導致中間出現白線。這在視覺上會破壞圖片的連續性。</p>
<h2 class="wp-block-heading">解決方案</h2>
<p>最簡單有效的方法是將 <code>&lt;img&gt;</code> 標籤的 CSS 屬性 <code>display</code> 設為 <code>block</code>，使圖片變成區塊元素，消除行內元素間的空白。</p>
<pre><code class="lang-css language-css css">img {
  display: block;
}</code></pre>
<p>這樣設定後，圖片間的空白白線就會消失，圖片可以無縫拼接。</p>
<h2 class="wp-block-heading">實際應用</h2>
<p>在實務中，只要在 CSS 中加入上述設定，或直接在圖片元素上加上 <code>style=&quot;display:block;&quot;</code>，即可快速解決問題。這對於 EDM 或需要精準排版的網頁設計非常實用。</p>
<h2 class="wp-block-heading">常見坑</h2>
<ul>
<li>直接刪除 HTML 中的空白字元不一定有效，因為瀏覽器仍會將行內元素間的空白視為間距。</li>
<li>使用 <code>float</code> 或 <code>flex</code> 也能解決，但相對複雜且可能影響其他排版。</li>
</ul>
<h2 class="wp-block-heading">完整程式碼</h2>
<pre><code class="lang-text language-text text">&lt;img src=&quot;圖片路徑&quot; style=&quot;display:block;&quot; /&gt;</code></pre>]]></content:encoded>
					
					<wfw:commentRss>https://piglife.tw/technical-notes/remove-html-img-white-space/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
