<?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>HTML5 Doctor</title>
	<atom:link href="http://html5doctor.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://html5doctor.com/</link>
	<description>Helping you implement HTML5 today</description>
	<lastBuildDate>Tue, 17 Nov 2026 11:47:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>http://html5doctor.com/wp-content/uploads/2026/10/html5doctor-icon-512.png</url>
	<title>HTML5 Doctor</title>
	<link>https://html5doctor.com/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Link to Another HTML Page in Same Folder: Examples and Fixes</title>
		<link>http://html5doctor.com/link-to-another-html-page-in-same-folder/</link>
		
		<dc:creator><![CDATA[HTML5 Doctor]]></dc:creator>
		<pubDate>Tue, 17 Nov 2026 11:47:03 +0000</pubDate>
				<category><![CDATA[Quick Tips]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6496</guid>

					<description><![CDATA[<p>To link to another HTML page in the same folder, enter the destination&#8217;s filename in the href attribute of an a (anchor) tag. This example goes from index.html to about.html. Save both pages together. You do not need JavaScript, a full website address or a button to make the hyperlink work. &#60;a href=&#34;about.html&#34;&#62;About the workshop&#60;/a&#62; [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/link-to-another-html-page-in-same-folder/">Link to Another HTML Page in Same Folder: Examples and Fixes</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="h5d-guide">
<div class="h5d-guide">
<p>To link to another HTML page in the same folder, enter the destination&#8217;s filename in the href attribute of an a (anchor) tag. This example goes from index.html to about.html. Save both pages together. You do not need JavaScript, a full website address or a button to make the hyperlink work.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;a href=&quot;about.html&quot;&gt;About the workshop&lt;/a&gt;</code></pre>
<p>The example is a repair workshop with two pages. Start at its homepage, follow the link to the about page and come back through a second link. Once that round trip works, add a shortcut to the access information. You can then carry the folder onto a web server without changing those relative links.</p>
<nav aria-label="Contents"><strong>Contents</strong></p>
<ul>
<li><a href="#syntax">Same-folder link syntax</a></li>
<li><a href="#example">Build two complete pages</a></li>
<li><a href="#paths">Compare relative paths</a></li>
<li><a href="#sections">Link to a section</a></li>
<li><a href="#publish">Check the uploaded pages</a></li>
<li><a href="#fix">Fix a broken link</a></li>
<li><a href="#faq">Frequently asked questions</a></li>
<li><a href="#quiz">Check your understanding</a></li>
</ul>
</nav>
<figure><img fetchpriority="high" decoding="async" src="https://html5doctor.com/wp-content/uploads/2026/11/link-to-another-html-page-same-folder-sibling-files.webp" alt="Diagram showing index.html linking to about.html in the same folder with href about.html." width="1600" height="900" style="max-width:100%;height:auto"><figcaption>A filename alone points to a sibling page when the document uses its normal base URL.</figcaption></figure>
<h2 id="syntax">Link to another HTML page in the same folder</h2>
<p>An anchor has an address and a label. The href attribute holds the address; the text inside the a element is what readers select. “About the workshop” gives them a useful destination. “Click here” leaves them to work it out from the surrounding sentence, which is less helpful when scanning links.</p>
<p>A filename without a leading slash is resolved against the document&#8217;s base URL. Normally that is the current page&#8217;s URL, so about.html points into the same URL directory. LSU&#8217;s <a href="https://www.lsu.edu/faculty/lray2/html/relative.html">relative-link explanation</a> demonstrates this filename-only form and distinguishes it from a path into a subdirectory.</p>
<p>Type straight quotation marks around the address and use forward slashes in paths. Close the anchor tag after the label. Watch for two easy slips: href accidentally written as src, and an editor saving about.html as about.html.txt. Neither problem is fixed by moving the file into another folder.</p>
<h2 id="example">Build a complete two-page example</h2>
<p>Create a new workshop folder. Put the first block of code in index.html and save the second block as about.html in that same directory. Use UTF-8 encoding for both files. Check the folder now: there should be two documents. Combining the blocks into one file introduces a problem before the navigation exercise begins.</p>
<h3>index.html: the starting page</h3>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;!doctype html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
  &lt;title&gt;Repair workshop&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;main&gt;
    &lt;h1&gt;Repair workshop&lt;/h1&gt;
    &lt;p&gt;Bring a broken household item on Saturday.&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;about.html&quot;&gt;Read about the workshop&lt;/a&gt;&lt;/p&gt;
  &lt;/main&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<h3>about.html: the destination and return link</h3>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;!doctype html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
  &lt;title&gt;About the workshop&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;main&gt;
    &lt;h1&gt;About the workshop&lt;/h1&gt;
    &lt;p id=&quot;access&quot;&gt;The entrance has step-free access.&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;index.html&quot;&gt;Return to the workshop homepage&lt;/a&gt;&lt;/p&gt;
  &lt;/main&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>Open index.html in your browser. Select “Read about the workshop”, then use “Return to the workshop homepage” on the destination page. Check the headings and browser titles as you go. Test the actual return link here; using the browser&#8217;s Back button would not tell you whether that link&#8217;s address is correct.</p>
<p>An editor&#8217;s preview can complicate that check. Look at its address before changing your markup: some tools serve previews from their own locations. Try the saved document itself, or open it through your local development server. You need to know which page address the browser is actually using.</p>
<p>The example uses normal links because it navigates between documents. Keep their visible focus indication and test them with Tab followed by Enter. Later, if you want a larger clickable content card, our article on <a href="https://html5doctor.com/block-level-links-in-html-5/">wrapping content in a link</a> covers that pattern. Do not put another link or button inside the same anchor.</p>
<h2 id="paths">Compare filenames, leading slashes and parent folders</h2>
<p>For the next examples, suppose the homepage address is https://example.com/workshop/index.html. Read each row as an instruction from that starting point. example.com is an illustrative domain, so substitute your own deployed address when checking a real project. The table deliberately includes paths that leave the workshop directory.</p>
<div role="region" aria-label="Paths from /workshop/index.html" tabindex="0" style="max-width:100%">
<table>
<caption>Paths from /workshop/index.html</caption>
<thead>
<tr>
<th scope="col">href value</th>
<th scope="col">Resolved path</th>
<th scope="col">Use</th>
</tr>
</thead>
<tbody>
<tr>
<td>about.html</td>
<td>/workshop/about.html</td>
<td>Sibling page</td>
</tr>
<tr>
<td>./about.html</td>
<td>/workshop/about.html</td>
<td>Explicit current directory</td>
</tr>
<tr>
<td>/about.html</td>
<td>/about.html</td>
<td>Site root</td>
</tr>
<tr>
<td>details/access.html</td>
<td>/workshop/details/access.html</td>
<td>Child folder</td>
</tr>
<tr>
<td>../about.html</td>
<td>/about.html</td>
<td>Parent directory</td>
</tr>
</tbody>
</table>
</div>
<p>Both about.html and ./about.html stay in the current directory. The dot in ./ makes that starting point explicit. Remove the dot but keep the slash and the result changes: /about.html starts at the site root. For a project under /workshop/, that is a different destination.</p>
<figure><img decoding="async" src="https://html5doctor.com/wp-content/uploads/2026/11/html-same-folder-link-relative-and-root-paths.webp" alt="Comparison of about.html and slash about.html resolving to different website paths." width="1600" height="900" style="max-width:100%;height:auto"><figcaption>At a workshop page, about.html stays under workshop; /about.html starts at the site root.</figcaption></figure>
<p>There is no connection between URL resolution and whichever folder you last selected in your editor. The browser works from the page address. A rewritten server route can therefore produce a surprising result even when the two files appear adjacent on disk. Read the URL rather than guessing from the disk layout.</p>
<p>Notice the trailing slash in /workshop/. From that address, about.html stays under /workshop/. From /workshop without a redirect, it resolves at the site root. These addresses look almost identical but supply different bases. If your server redirects one to the other, use the final address shown in the browser.</p>
<p>Check the document head for a base element if relative links seem to ignore the page&#8217;s location. A base element with href changes how those URLs resolve, including image and stylesheet addresses. This example has no such override. Adding one to repair a single link can disturb other resources that already work.</p>
<p>For a useful failure exercise, make a copy of the project folder and move about.html into a new details subfolder. Follow the original homepage link: it still asks for the old location. Change that copy&#8217;s link to details/about.html. The return link now needs ../index.html because it starts one directory deeper. Keep your original two-page example unchanged for comparison.</p>
<h2 id="sections">Link straight to a section of the other page</h2>
<p>Find id=&#8221;access&#8221; in about.html. That paragraph is the target for the next link, which belongs in index.html. The filename gets the reader onto the other page; #access identifies the part of that page you want them to reach. Keep the entire address together inside href.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;a href=&quot;about.html#access&quot;&gt;Check step-free access&lt;/a&gt;</code></pre>
<p>Test the section link independently of the ordinary about link. A typo after the hash can still load about.html and make the link look successful. Compare that fragment with the destination ID and check that the ID is unique. You are checking both page navigation and section targeting, rather than only whether the browser changed pages.</p>
<h2 id="publish">Check the files after uploading</h2>
<p>Upload index.html and about.html into the same directory. For this example, that is the workshop directory on your server. If you upload only index.html, its anchor remains visible in the source but there is no destination page for the server to deliver. A hyperlink does not create or upload the file it references.</p>
<p>Colorado State University&#8217;s <a href="https://www.engr.colostate.edu/ets/html-linking-basics/">HTML linking guidance</a> highlights the difference between a local computer location and the directory served on the web. Keep public page targets within the deployed site. A link into your own computer&#8217;s drive will not make that file available to visitors.</p>
<p>First open the deployed about-page address directly. Then visit the deployed homepage and follow its link. Does it request exactly the same address? Finally, follow the return link. Keep those expected URLs next to your file list so that you can compare the requested destination with the uploaded location.</p>
<p>Style files use relative paths too, though a stylesheet connection belongs in the head rather than a visible navigation anchor. If the HTML opens but its design is missing, our guide to <a href="https://html5doctor.com/how-to-link-css-to-html/">linking CSS to HTML</a> explains that separate connection. Changing the text of a navigation link will not load a missing stylesheet.</p>
<h2 id="fix">Fix a link that opens the wrong page or returns 404</h2>
<p>Read the destination address after following the failing link. Does it contain the expected directory and filename? George Mason University&#8217;s <a href="https://mason.gmu.edu/~dtaciuch/webdev/troublelinks.html">link-troubleshooting guide</a> uses this address check to identify links that accidentally point to a local drive. It also explains why moving a target can break an otherwise unchanged relative link.</p>
<div role="region" aria-label="Broken-link checks" tabindex="0" style="max-width:100%">
<table>
<caption>Broken-link checks</caption>
<thead>
<tr>
<th scope="col">Symptom</th>
<th scope="col">Check</th>
<th scope="col">Likely correction</th>
</tr>
</thead>
<tbody>
<tr>
<td>Unexpected folder</td>
<td>Requested URL after following the link</td>
<td>Remove an unintended leading slash or fix the relative path</td>
</tr>
<tr>
<td>Works locally only</td>
<td>href contains file: or a drive path</td>
<td>Use a website-relative address and upload the target</td>
</tr>
<tr>
<td>404 at the expected URL</td>
<td>Published file name and location</td>
<td>Upload or rename the target; match case and extension</td>
</tr>
<tr>
<td>Correct page, wrong section</td>
<td>Target ID spelling</td>
<td>Match the fragment to an existing unique ID</td>
</tr>
</tbody>
</table>
</div>
<p>Match the case of the deployed filename. Some local setups tolerate About.html when the link says about.html; another host may treat those as different paths. Do not depend on the forgiving setup. Compare the actual server filename with your markup, including the .htm or .html extension.</p>
<p>Lowercase names separated with hyphens are convenient for a new project. Existing names may contain spaces, represented as %20 in a URL. Renaming a published file changes its address, though. Update its incoming links and plan redirects where necessary before turning a filename cleanup into broken navigation.</p>
<figure><img decoding="async" src="https://html5doctor.com/wp-content/uploads/2026/11/html-page-link-troubleshooting-address-check.webp" alt="Three checks for a broken HTML link: destination address, exact filename and uploaded location." width="1600" height="900" style="max-width:100%;height:auto"><figcaption>Read the requested address first, then compare it with the file you actually uploaded.</figcaption></figure>
<p>Want to see the address before opening it? Enter these expressions in developer tools. Each constructs a URL; neither makes a request. A correct-looking result therefore tells you where the browser would go, without proving that the server has a page there. Check the response separately.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">new URL(&quot;about.html&quot;, &quot;https://example.com/workshop/index.html&quot;).href
// https://example.com/workshop/about.html

new URL(&quot;/about.html&quot;, &quot;https://example.com/workshop/index.html&quot;).href
// https://example.com/about.html</code></pre>
<h2 id="faq">Frequently asked questions</h2>
<h3>Do I need ./ before the filename?</h3>
<p>No. about.html and ./about.html resolve alike in this example. The extra dot makes “current directory” explicit, but is not required. Pick a consistent style for the project.</p>
<h3>Should the page open in a new tab?</h3>
<p>There is no need for a new tab here. An ordinary anchor uses the current browsing context. Leave out target=&#8221;_blank&#8221; for this example; moving to another document does not require it.</p>
<h3>Can I link without the .html extension?</h3>
<p>That depends on your server&#8217;s routing. href=&#8221;about&#8221; is an address of its own, not an instruction to search for a file named about.html. Use the address the host supports and verify it after deployment.</p>
<h3>Will the links survive moving the folder?</h3>
<p>Moving both pages together can preserve their relationship, provided there is no base override. Moving just one page usually changes it. Recheck the whole round trip after reorganizing your project, rather than testing only the new destination in isolation.</p>
<h2 id="quiz">Check your understanding</h2>
<details>
<summary>Both files are under /workshop/. Which href points to its about page?</summary>
<p>about.html, or ./about.html. A leading slash would request /about.html at the site root instead.</p>
</details>
<details>
<summary>Does constructing a URL prove that the destination exists?</summary>
<p>No. URL resolution builds an address. A separate request is needed to check the page&#8217;s response.</p>
</details>
<details>
<summary>The page opens but the access section is not reached. What next?</summary>
<p>Compare the fragment with the destination ID. Check access for exact spelling and uniqueness in about.html.</p>
</details>
</div>
</div>
<p>The post <a href="http://html5doctor.com/link-to-another-html-page-in-same-folder/">Link to Another HTML Page in Same Folder: Examples and Fixes</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>HTML Set Font Size: A Reusable CSS Type Scale</title>
		<link>http://html5doctor.com/html-set-font-size/</link>
		
		<dc:creator><![CDATA[Steve Faulkner]]></dc:creator>
		<pubDate>Mon, 16 Nov 2026 13:07:38 +0000</pubDate>
				<category><![CDATA[Quick Tips]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6491</guid>

					<description><![CDATA[<p>Use CSS font-size to set text size in HTML. For one paragraph, add style="font-size: 1.25rem;" to its opening tag. Use a class when the same size applies in several places. This HTML set font size tutorial builds a small scale for a workshop page, then traces the rule behind its price label. A short type [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/html-set-font-size/">HTML Set Font Size: A Reusable CSS Type Scale</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="h5d-guide">
<div class="h5d-guide">
<p>Use CSS <code style="background:#ffffff !important;color:#172331 !important">font-size</code> to set text size in HTML. For one paragraph, add <code style="background:#ffffff !important;color:#172331 !important">style="font-size: 1.25rem;"</code> to its opening tag. Use a class when the same size applies in several places. This HTML set font size tutorial builds a small scale for a workshop page, then traces the rule behind its price label.</p>
<figure data-role="featured"><img loading="lazy" decoding="async" src="https://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-reusable-type-scale.webp" alt="HTML set font size example mapping a title, body copy and button to a shared CSS type scale." width="1600" height="900" style="display:block;max-width:100%;height:auto" class="wp-image-6488" srcset="http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-reusable-type-scale.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-reusable-type-scale-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-reusable-type-scale-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-reusable-type-scale-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-reusable-type-scale-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>A short type scale gives each piece of text a clear job and a reusable size.</figcaption></figure>
<nav aria-label="Contents">
<p><strong>Contents</strong></p>
<ol>
<li><a href="#quick-start">Set one size, then name the roles</a></li>
<li><a href="#complete-page">Copy the complete workshop page</a></li>
<li><a href="#scope">Change the page or one component</a></li>
<li><a href="#units">Read the units and calculations</a></li>
<li><a href="#inspect">Find the winning declaration</a></li>
<li><a href="#readability">Keep enlarged text usable</a></li>
<li><a href="#questions">Questions and self-check</a></li>
</ol>
</nav>
<h2 id="quick-start">HTML set font size: begin with a small scale</h2>
<p>If you&#8217;re just looking to change the size of one paragraph, try the single-paragraph version first.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;p style="font-size: 1.25rem;"&gt;Places are available.&lt;/p&gt;</code></pre>
<p>That paragraph calculates out to be 20px at a 16px root. When you create a rule that states something in relation to a base value, it means a different default can give a different result. At a 20px root it becomes 25px. The unit of measurement is a multiplier, not an absolute guarantee that everyone will view the exact same numbers on their monitor.</p>
<p>For repeating items, call the size by its function. The custom properties in the next example are simply regular CSS variables. The names describe the type of item. A price can share an emphasis function with an announcement without having to use the same HTML tag.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">:root {
  --text-body: 1rem;
  --text-emphasis: 1.375rem;
  --text-title: 2rem;
}
body { font-size: var(--text-body); }
.price { font-size: var(--text-emphasis); }
.page-title { font-size: var(--text-title); }</code></pre>
<p>Don&#8217;t make your scale too long or it will be difficult to understand. Those three values are just a good start for this example. Add another type when there&#8217;s a piece of content that needs it.</p>
<h2 id="complete-page">Copy the complete workshop page</h2>
<p>Save this as <code style="background:#ffffff !important;color:#172331 !important">workshop.html</code> and load it in a browser. All the materials necessary for this exercise are contained within the file itself. Although it is linked to the booking area later in the document, the booking link does not send a booking request.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;title&gt;Repair workshop&lt;/title&gt;
  &lt;style&gt;
    :root {
      --text-body: 1rem;
      --text-emphasis: 1.375rem;
      --text-title: 2rem;
    }
    html { font-size: 100%; }
    body {
      margin: 0;
      padding: 1rem;
      font-family: system-ui, sans-serif;
      font-size: var(--text-body);
      line-height: 1.6;
      color: #172331;
      background: #ffffff;
    }
    main { max-width: 42rem; margin-inline: auto; }
    .workshop { padding: 1.25rem; border: 1px solid #cbd5e1; }
    .page-title { font-size: var(--text-title); line-height: 1.2; }
    .price { font-size: var(--text-emphasis); }
    .booking-link {
      display: inline-block;
      max-width: 100%;
      box-sizing: border-box;
      padding: 0.6em 1em;
      font-size: 1em;
      line-height: 1.4;
      color: #ffffff;
      background: #145545;
      border: 2px solid #145545;
      border-radius: 0.4rem;
      text-decoration: none;
      overflow-wrap: anywhere;
    }
    .booking-link:focus-visible {
      outline: 3px solid #172331;
      outline-offset: 3px;
    }
    h2 { font-size: 1.5rem; line-height: 1.3; }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;main&gt;
    &lt;article class="workshop"&gt;
      &lt;h1 class="page-title"&gt;Repair workshop&lt;/h1&gt;
      &lt;p&gt;Bring one small item and learn how to repair it.&lt;/p&gt;
      &lt;p class="price"&gt;Workshop fee: £12&lt;/p&gt;
      &lt;a class="booking-link" href="#booking"&gt;See booking details&lt;/a&gt;
    &lt;/article&gt;
    &lt;section id="booking" aria-labelledby="booking-heading"&gt;
      &lt;h2 id="booking-heading"&gt;Booking details&lt;/h2&gt;
      &lt;p&gt;Contact the workshop organizer to request a place.&lt;/p&gt;
    &lt;/section&gt;
  &lt;/main&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>Inspect the title, normal paragraph, price and booking link at a root font size of 16px. Their expected sizes are 32px, 16px, 22px and 16px. While browsers display lettering slightly differently depending upon font and operating system, the calculated CSS sizes are the ones to compare.</p>
<p>Change <code style="background:#ffffff !important;color:#172331 !important">--text-emphasis</code> from 1.375rem to 1.5rem. Save and reload. Only the price should increase from 22px to 24px at that root size. Because you&#8217;re still calling the same role name, any other items that use that role will change along with it.</p>
<p>It continues to act like a link because of the way it functions as navigation. If your site requires an action or a form submission instead of linking somewhere else, refer to the <a href="https://html5doctor.com/how-to-make-a-button-in-html/">guide to choosing and constructing HTML buttons</a>. Choose the element by its purpose.</p>
<h3>Move the scale into a shared stylesheet</h3>
<p>Once a second workshop page needs the same layout, create a file called <code style="background:#ffffff !important;color:#172331 !important">styles.css</code> directly next to your two HTML files. Copy everything inside those style tags over to that new file. Then replace the complete style element in each HTML file with this reference in its head.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;link rel="stylesheet" href="styles.css"&gt;</code></pre>
<p>Load both pages after saving. The layouts should be identical to before. Changing the emphasis variable in your shared stylesheet now updates both pages. If one page lost its styling, go check that page&#8217;s stylesheet reference instead of typing in the new size statements. Relative addresses resolve from your HTML file&#8217;s location; therefore, putting a page into a subdirectory changes what that address resolves to.</p>
<p>Continue testing this in a copy until both pages load from the shared file. It is easy to leave your original style element in one page while assuming your stylesheet import is working properly. Delete that original element after you&#8217;ve added the link to your pages and reload them again.</p>
<h2 id="scope">Change the page or just one component</h2>
<p>These changes need to be separated. A body role increase increases the size of normal page text. A root increase changes rem-based sizes throughout the whole document. An adjustment of only one component changes the custom property within that component.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">/* A larger default for ordinary page text */
body { --text-body: 1.125rem; }

/* An emphasis override inside this card */
.workshop { --text-emphasis: 1.5rem; }</code></pre>
<p>At a 16px root, the body change will make the ordinary copy 18px. However, the 2rem title will stay 32px as it refers to the root, not the body. The booking link is using 1em and therefore follows its inherited text size to 18px. The local size override makes the price 24px. Remove these experimental settings before you go back to the original values again.</p>
<p>Variables are not selectors. Setting a value on a component allows that value to be used by descendants, but a descendant will still require a property that references the variable. Be sure to check where the variable is being redeclared. A closer custom-property declaration can help explain why adjusting the root token seems like it had no effect.</p>
<p>Use the same workshop class for a second card. Give its heading an h2 if it belongs below the main heading of the page. Add the visual title class to the h2 if you want it sized similarly. This way, you can compare the two cards without having to create additional heading levels to allow the letters to fit.</p>
<p>Tie your heading level to your document outline. Even a small section title can be an h2. Why the real heading structure is important for navigation is explained in <a href="https://academicaffairs.rutgers.edu/accessibility-best-practices">Rutgers&#8217; accessibility guidelines</a>. CSS can give that heading whatever visual size is needed by the design.</p>
<h2 id="units">Read the units before changing the numbers</h2>
<p>The CSS Working Group <a href="https://drafts.csswg.org/css-fonts-4/#font-size-prop">defines what font-size means</a> and how it behaves in terms of inheritance and allowed values. The section is an editor&#8217;s draft; the basic sizing behavior that we are demonstrating here is established CSS.</p>
<div class="table-scroll" role="region" aria-label="Units used in the type scale" tabindex="0">
<table>
<caption>What each font-size value refers to</caption>
<thead>
<tr>
<th scope="col">Value</th>
<th scope="col">Reference</th>
<th scope="col">Example result</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1.375rem</th>
<td>Root font size</td>
<td>22px at a 16px root</td>
</tr>
<tr>
<th scope="row">1.25em</th>
<td>Parent&#8217;s computed font size</td>
<td>25px with a 20px parent</td>
</tr>
<tr>
<th scope="row">125%</th>
<td>Parent&#8217;s computed font size</td>
<td>25px with a 20px parent</td>
</tr>
<tr>
<th scope="row">22px</th>
<td>CSS pixel length</td>
<td>22 CSS pixels regardless of the parent&#8217;s size</td>
</tr>
</tbody>
</table>
</div>
<p>Text can still expand due to page zoom even though it was created using pixel lengths. We are using rem here to establish the scale with respect to the root and, with a relative root, to the user&#8217;s selected default. Simply increasing the body size does not redefine a rem.</p>
<p>The <a href="https://html5doctor.com/how-to-change-font-size-in-html/">introductory font-size guide</a> covers nested ems and responsive headings in greater detail. In this case, what matters is whether a given size belongs to the overall page scale or should follow along with surrounding components. Consider rem for the former and em for the latter.</p>
<h2 id="inspect">Find the declaration that actually wins</h2>
<p>Assume that the price is refusing to get bigger after an edit to a token. Select the price in the browser inspector and find its computed font-size. Expand the value to track down the winning rule. A crossed-out rule indicates that another declaration took precedence; it does not necessarily indicate that the value is invalid.</p>
<figure data-role="cascade"><img loading="lazy" decoding="async" src="https://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-trace-css-variable.webp" alt="Diagram tracing a price class through its CSS custom property to a computed size of 22px at a 16px root." width="1600" height="1000" style="display:block;max-width:100%;height:auto" class="wp-image-6489" srcset="http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-trace-css-variable.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-trace-css-variable-300x188.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-trace-css-variable-1024x640.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-trace-css-variable-768x480.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-trace-css-variable-1536x960.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>Trace the element&#8217;s font-size declaration, the variable it uses and the root value before changing the scale.</figcaption></figure>
<p>Inline styles are a very common suspect when someone cannot figure out why something will not grow. An ordinary rule on a class loses to an ordinary inline declaration for font-size on that same element. Remove the unwanted inline declaration at its origin instead of piling another layer of override over it.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;!-- The inline declaration keeps this at 18px. --&gt;
&lt;p class="price" style="font-size: 18px;"&gt;Workshop fee: £12&lt;/p&gt;

&lt;!-- This version uses the class and its shared token. --&gt;
&lt;p class="price"&gt;Workshop fee: £12&lt;/p&gt;</code></pre>
<p>A later font shorthand could reset the size too. For example, <code style="background:#ffffff !important;color:#172331 !important">font: 16px Arial, sans-serif;</code> establishes a size as well as a family. When you simply wish to modify the typeface, set font-family instead. For native form controls, a useful deliberate reset would be <code style="background:#ffffff !important;color:#172331 !important">font: inherit;</code>. Inspect them after adding it.</p>
<div class="table-scroll" role="region" aria-label="Font size troubleshooting" tabindex="0">
<table>
<caption>Checks before adding another override</caption>
<thead>
<tr>
<th scope="col">Symptom</th>
<th scope="col">Check next</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">No new rule appears</th>
<td>Save the file, reload and confirm the stylesheet loaded.</td>
</tr>
<tr>
<th scope="row">Token changed but price did not</th>
<td>Look for a local variable or direct size overriding it.</td>
</tr>
<tr>
<th scope="row">Size returns after a font edit</th>
<td>Check for a later font shorthand declaration.</td>
</tr>
<tr>
<th scope="row">Correct size looks unexpectedly small</th>
<td>Check the actual font family and its letter proportions.</td>
</tr>
</tbody>
</table>
</div>
<h2 id="readability">Keep the page usable when text grows</h2>
<p>Try reloading the original example at larger browser defaults. At a 20px root, title, body, price and link should compute to 40px, 20px, 27.5px and 20px respectively. The booking label has no set height; therefore it can wrap rather than lose words.</p>
<figure data-role="defaults"><img loading="lazy" decoding="async" src="https://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-larger-browser-default.webp" alt="Two workshop cards compare a 16px root and a 20px root, with title, body and price sizes scaling together." width="1600" height="1000" style="display:block;max-width:100%;height:auto" class="wp-image-6490" srcset="http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-larger-browser-default.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-larger-browser-default-300x188.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-larger-browser-default-1024x640.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-larger-browser-default-768x480.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/html-set-font-size-larger-browser-default-1536x960.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>A relative root lets the same rem scale respond to a larger default text size.</figcaption></figure>
<p>Next try page zoom up through 200%, checking along the way. Read all words, navigate to the booking link and check the destination. Also try narrowing the window and using longer titles. Look for clipped labels, overlapping text and horizontal scrolling caused by fixed-size containers. Increasing a single number only helps if the resulting content still fits.</p>
<p>Document which option you changed. A narrower viewport, larger default fonts and page zoom test different aspects of layout. If you alter all three simultaneously, you may solve the wrong problem. Restore the original setting before performing the next check, leave the long label intact, and repeat any failed check after a CSS modification.</p>
<p>Legibility depends on the font used and the amount of space provided around it. The <a href="https://www.colorado.edu/digital-accessibility/newsletter/accessibility-minute-april-2021">University of Colorado Boulder guidance on accessible fonts</a> recommends legible letterforms, adequate spacing and real text. Provide important workshop information as HTML text; illustrations demonstrate the lesson rather than replace that information.</p>
<h2 id="questions">Questions and a quick self-check</h2>
<h3>Can I use a size attribute on a paragraph?</h3>
<p>Paragraphs do not have a general-purpose attribute for their text size. Use CSS font-size instead. The old font element is obsolete; its numbering system for sizes is not a substitute for a CSS type scale.</p>
<h3>Does 1rem always mean 16px?</h3>
<p>No; it equals the computed font size of the root. A common browser default is 16px, but user preference and author CSS can vary the result.</p>
<h3>Should every heading have its own variable?</h3>
<p>Only if the design requires such differentiation. Semantic heading levels and visual size roles serve different functions. Multiple headings may share a visual role while maintaining their proper positions in the outline.</p>
<details>
<summary>1. The root is 20px. What is 1.375rem?</summary>
<p>27.5 CSS pixels. Multiply 20 by 1.375.</p>
</details>
<details>
<summary>2. The body becomes 18px. Does a 2rem title become 36px?</summary>
<p>Only if the root also becomes 18px. With the root still at 16px, the title remains 32px.</p>
</details>
<details>
<summary>3. A price has both a class rule and an ordinary inline size. Which should you inspect?</summary>
<p>Inspect the inline declaration and the computed value. Remove an unwanted inline size so the shared class can control the price.</p>
</details>
</div>
</div>
<p>The post <a href="http://html5doctor.com/html-set-font-size/">HTML Set Font Size: A Reusable CSS Type Scale</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Add Website to Home Screen on iPhone and Android</title>
		<link>http://html5doctor.com/how-to-add-website-to-home-screen/</link>
		
		<dc:creator><![CDATA[HTML5 Doctor]]></dc:creator>
		<pubDate>Mon, 16 Nov 2026 11:29:54 +0000</pubDate>
				<category><![CDATA[Quick Tips]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6486</guid>

					<description><![CDATA[<p>Here is how to add website to home screen shortcuts on your phone: open the page in Safari on iPhone or Chrome on Android, use the browser&#8217;s Share or menu controls, then confirm Add to Home Screen, Create shortcut or Install. The wording depends on the browser and the site. Start with the exact page [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/how-to-add-website-to-home-screen/">How to Add Website to Home Screen on iPhone and Android</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="h5d-guide">
<div class="h5d-guide">
<p>Here is how to add website to home screen shortcuts on your phone: open the page in Safari on iPhone or Chrome on Android, use the browser&#8217;s Share or menu controls, then confirm Add to Home Screen, Create shortcut or Install. The wording depends on the browser and the site. Start with the exact page you want to return to, rather than a search-results page.</p>
<p>The benefit is simple: next time, tap an icon instead of typing the address again. But check what that tap actually does. Saving the icon does not guarantee a native app, an existing login or offline access. A page that opens successfully in Safari may still ask you to sign in when launched another way.</p>
<nav aria-label="Contents"><strong>Contents</strong></p>
<ul>
<li><a href="#choose">Choose a shortcut or web app</a></li>
<li><a href="#iphone">Add a website on iPhone</a></li>
<li><a href="#android">Add a website on Android</a></li>
<li><a href="#example">Work through a real task</a></li>
<li><a href="#fixes">Fix missing options and wrong pages</a></li>
<li><a href="#owners">Help visitors save your own site</a></li>
<li><a href="#faq">Frequently asked questions</a></li>
<li><a href="#quiz">Quick self-check</a></li>
</ul>
</nav>
<figure><img loading="lazy" decoding="async" alt="Diagram of iPhone and Android routes for adding a website to the home screen." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/add-website-to-home-screen-phone-routes.webp" style="max-width:100%;height:auto" width="1600" /><figcaption>Start at the intended page, then use the browser controls for your phone.</figcaption></figure>
<h2 id="choose">Choose a shortcut or an installed web app</h2>
<p>There are two useful outcomes to distinguish. A shortcut usually takes you to a browser page. A web app can open in its own window, with less browser interface around it. Both may put an icon on your home screen. The similar appearance tells you little about which features will work once you open it.</p>
<div aria-label="Shortcut and web app comparison" role="region" style="max-width:100%" tabindex="0">
<table>
<caption>What the home-screen action can give you</caption>
<thead>
<tr>
<th scope="col">Action</th>
<th scope="col">Typical result</th>
<th scope="col">Check afterward</th>
</tr>
</thead>
<tbody>
<tr>
<td>Create shortcut</td>
<td>A direct route to a web address</td>
<td>Does the intended page open?</td>
</tr>
<tr>
<td>Install a web app</td>
<td>An app-like launch experience</td>
<td>Does sign-in work in that window?</td>
</tr>
<tr>
<td>Save a browser bookmark</td>
<td>A link stored inside the browser</td>
<td>It may not create a home-screen icon</td>
</tr>
</tbody>
</table>
</div>
<p>You do not need to write HTML to save someone else&#8217;s site. The University of Florida&#8217;s <a href="https://m.ifas.ufl.edu/help/">UF/IFAS mobile help</a>, for example, describes a one-touch shortcut to its own site. That is a useful goal for a timetable, reference page or club noticeboard: make the next visit easier.</p>
<h2 id="iphone">How to add website to home screen on iPhone</h2>
<ol>
<li>Open Safari and navigate to the website. Wait for the page you actually want to save.</li>
<li>Open Share. Depending on Safari&#8217;s layout, tap the Share symbol directly or open the page menu first and choose Share.</li>
<li>Scroll through the actions and choose Add to Home Screen.</li>
<li>Check the suggested name. Choose a short label that will still make sense beside your other icons.</li>
<li>If Open as Web App is offered, turn it on when you want an app-like launch.</li>
<li>Tap Add, return to the Home Screen and open the new icon.</li>
</ol>
<p>Cannot see the action? Expand the Share sheet and continue down its list. Look for Edit Actions, then make Add to Home Screen available. There is a small but important distinction here: the sharing button supplied by the website may only post to social networks. Use Safari&#8217;s controls for this task.</p>
<p>West Chester University&#8217;s <a href="https://www.wcupa.edu/app/download-directions.aspx">mobile web app directions</a> document the Share route, Edit Actions and Open as Web App for its own service. The position of Share can move with Safari&#8217;s layout; the action&#8217;s name is a more useful guide than “always tap the bottom button.”</p>
<p>Chrome on iPhone can also provide Add to Home Screen through its Share controls. If instructions written for Safari do not match the app you are using, open Safari directly and try the steps there. A link opened inside an email or social app may be using that app&#8217;s built-in browser instead.</p>
<p>A downloaded HTML attachment is a separate case. It may open as a file preview rather than a normal hosted website. See our <a href="https://html5doctor.com/how-to-open-html-file-on-iphone/">guide to opening HTML files on iPhone</a> if you are starting with a file in Files or an attachment, rather than a web address.</p>
<h2 id="android">Add a website to the Android home screen</h2>
<p>Use Chrome for these steps. Samsung Internet, Firefox and other browsers have their own menus, so a missing Chrome label in a different app does not mean the site cannot be saved.</p>
<ol>
<li>Open the site in Chrome and reach the page you want.</li>
<li>Tap the three-dot menu beside the address bar.</li>
<li>Look for Install and create shortcut. For a browser shortcut, choose Create shortcut, rename it if necessary, then tap Add.</li>
<li>For an available web app, choose Install and follow the confirmation prompts. Some versions show Install app or Add to Home screen instead.</li>
<li>Check the Home screen and app launcher. If the launcher asks you to place the icon, confirm its placement.</li>
<li>Open it once to check the destination and any sign-in requirement.</li>
</ol>
<p>Read the choices on your device before confirming. If you want the timetable in a normal browser tab, look for the shortcut choice. Install is not always just another name for a bookmark. A site&#8217;s capabilities and your version of Chrome determine which choices appear.</p>
<p>Check the app drawer if the familiar home page looks unchanged. Your launcher may have placed the item elsewhere or may still need you to confirm placement. Find that first icon before making another. Three copies named “Timetable” will not help you work out which one opens the right page.</p>
<figure><img loading="lazy" decoding="async" alt="Comparison of a browser shortcut and an installed web app, with separate checks for destination and sign-in." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/add-website-to-home-screen-shortcut-or-install.webp" style="max-width:100%;height:auto" width="1600" /><figcaption>A shortcut and a web app can launch differently; check the result rather than judging the icon.</figcaption></figure>
<h2 id="example">A worked example: save a club timetable</h2>
<p>Suppose you swim with a local club and check its timetable every week. Open the current timetable and confirm the club&#8217;s domain, then follow the route for your phone. Call the icon “Club timetable.” Finish the Add or Install confirmation and return to the home screen before testing it.</p>
<p>Tap the new icon. A timetable, a club homepage and a sign-in screen are three different results. If you land on the homepage, compare the saved address with the timetable address. A web app may also have a launch URL chosen by its owner. If you get a sign-in screen instead, try the genuine site&#8217;s normal authentication process in that window.</p>
<p>After signing in, check that the timetable is reachable. Save a stable address, rather than a link intended for one sign-in only. Keep passwords and one-time codes out of shortcut labels. The label is visible alongside the other icons on your phone; it is not a place to store credentials.</p>
<p>There are real uses beyond timetables. Ohio State&#8217;s <a href="https://www.osu.edu/alumni/events-and-travel/buckeye-beverage-bites-tour">digital tour pass instructions</a> explain adding its pass from a received link. That example also shows why the destination matters: save the actual pass you were sent, rather than an unrelated information page. Treat private pass links as private.</p>
<h2 id="fixes">Fix missing options, icons and unexpected behavior</h2>
<div aria-label="Home screen troubleshooting" role="region" style="max-width:100%" tabindex="0">
<table>
<caption>Check the symptom before adding the site again</caption>
<thead>
<tr>
<th scope="col">Problem</th>
<th scope="col">First check</th>
<th scope="col">Next step</th>
</tr>
</thead>
<tbody>
<tr>
<td>No home-screen action</td>
<td>Are you inside another app&#8217;s browser?</td>
<td>Open the address in Safari or Chrome</td>
</tr>
<tr>
<td>Wrong page opens</td>
<td>Saved URL and site redirects</td>
<td>Try the stable page address in the browser</td>
</tr>
<tr>
<td>Icon seems missing</td>
<td>Other home pages and the launcher</td>
<td>Find the existing icon before creating another</td>
</tr>
<tr>
<td>Works only online</td>
<td>Whether that site supports offline use</td>
<td>Keep a connection or use a supported offline option</td>
</tr>
<tr>
<td>Login is requested</td>
<td>Normal authentication in the new window</td>
<td>Sign in through the genuine site</td>
</tr>
</tbody>
</table>
</div>
<p>If an organization manages the phone, its restrictions may affect installation or home-screen changes. Ask its support team rather than changing management settings. For an ordinary personal phone, checking the browser and its current menu is a better first step than clearing all stored data.</p>
<p>To remove the saved item, touch and hold its icon and read the available actions. Remove and Uninstall can do different things. A shortcut may only need removal from the home screen; an installed web app may offer Uninstall in Android&#8217;s app settings. Neither action should be confused with closing your account at the website.</p>
<p>Test offline behavior separately. First open the saved item while connected and read what the site says it supports offline. Then, if appropriate, try that supported task without a connection. A previously viewed page appearing on screen does not prove that new pages or forms work. Reconnect before a task that requires a server response, such as sending a payment.</p>
<figure><img loading="lazy" decoding="async" alt="Three checks for a saved website: correct destination, working sign-in and supported offline features." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/add-website-to-home-screen-verification.webp" style="max-width:100%;height:auto" width="1600" /><figcaption>Test the saved destination, authentication and offline features as separate questions.</figcaption></figure>
<h2 id="owners">Help visitors save your own website</h2>
<p>Make the useful destination easy to reach first. A clear timetable URL, descriptive title and responsive page do more for visitors than an “Install now” banner that cannot perform the action. Provide device-specific instructions as a fallback, and keep essential content available in the browser.</p>
<p>A web app manifest lets a site describe its name, icons, starting URL and display preference. Our <a href="https://html5doctor.com/web-manifest-specification/">early introduction to the manifest specification</a> explains its background; it is historical context, not a current installation checklist. The small example here illustrates the relationship between the files.</p>
<p>Add the link in the document head:</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;link rel="manifest" href="/site.webmanifest"&gt;</code></pre>
<p>Save the following JSON as site.webmanifest:</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">{
  "name": "Club Timetable",
  "short_name": "Timetable",
  "start_url": "/",
  "scope": "/",
  "display": "standalone",
  "icons": [
    {
      "src": "/icon-192.png",
      "sizes": "192x192",
      "type": "image/png"
    },
    {
      "src": "/icon-512.png",
      "sizes": "512x512",
      "type": "image/png"
    }
  ]
}</code></pre>
<p>For this example, serve the HTML and manifest from the site root over HTTPS and provide both real PNG icon files with the stated dimensions. Keep the icon artwork readable at small sizes. The manifest&#8217;s root start URL opens the homepage, so change it deliberately if visitors should launch a specific section. This metadata does not implement offline caching or guarantee an install prompt in every browser.</p>
<h2 id="faq">Frequently asked questions</h2>
<h3>Will adding a site cost money?</h3>
<p>Creating a shortcut itself does not purchase a subscription. The site&#8217;s normal charges and your connection&#8217;s data costs can still apply. Read any payment screen as a separate transaction.</p>
<h3>Does it keep me signed in?</h3>
<p>It depends on the site&#8217;s sessions and the way the item launches. Test it before you need it urgently. Being signed in to a browser tab does not establish what will happen in a separately launched web app.</p>
<h3>Can I change the name?</h3>
<p>You can usually choose a label while creating a shortcut. Later renaming options depend on the platform and launcher. Start with a short, recognizable name.</p>
<h3>Does the icon prove the website is safe?</h3>
<p>No. Check the destination address and use the site&#8217;s normal sign-in process. An appealing icon or familiar-looking name is not proof of ownership.</p>
<h2 id="quiz">Quick self-check</h2>
<details>
<summary>A timetable icon opens a homepage. Should you reinstall repeatedly?</summary>
<p>No. Check the saved page, redirects and any app start URL. Repeating the same action may create duplicates without changing the destination.</p>
</details>
<details>
<summary>Does installing the icon guarantee offline forms?</summary>
<p>No. Offline behavior must be implemented by the site. A form that sends data to a server normally needs a connection to complete that task.</p>
</details>
<details>
<summary>Which sharing control should you use?</summary>
<p>Use the browser&#8217;s Share or menu controls. A sharing button inside the web page may only offer social networks or copy a link.</p>
</details>
</div>
</div>
<p>The post <a href="http://html5doctor.com/how-to-add-website-to-home-screen/">How to Add Website to Home Screen on iPhone and Android</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Save WebP as JPG and Check the Export</title>
		<link>http://html5doctor.com/how-to-save-webp-as-jpg/</link>
		
		<dc:creator><![CDATA[Steve Faulkner]]></dc:creator>
		<pubDate>Wed, 11 Nov 2026 15:16:45 +0000</pubDate>
				<category><![CDATA[Elements]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6473</guid>

					<description><![CDATA[<p>I made two files with .jpg names for this example. One was a real JPEG; the other still contained WebP data. Here is how to save WebP as JPG properly: open it in GIMP, choose File → Export As, enter a fresh .jpg filename and confirm JPEG. Then open the exported copy. The file with [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/how-to-save-webp-as-jpg/">How to Save WebP as JPG and Check the Export</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="h5d-guide">
<div class="h5d-guide">
<p>I made two files with .jpg names for this example. One was a real JPEG; the other still contained WebP data. Here is how to save WebP as JPG properly: open it in GIMP, choose File → Export As, enter a fresh .jpg filename and confirm JPEG. Then open the exported copy. The file with the renamed extension is the one that can catch you out.</p>
<p>The source is a little North Pier badge with transparent corners. I kept that WebP and made separate JPEG copies, including white and dark backgrounds. I also compared two quality settings. Those copies give us something concrete to check instead of relying on the filename.</p>
<figure><img loading="lazy" decoding="async" alt="How to save WebP as JPG: a transparent North Pier badge beside a JPEG exported onto white." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-save-webp-as-jpg-real-conversion.webp" style="display:block;max-width:100%;height:auto" width="1600"><figcaption>The JPEG keeps the 960 by 640 pixel canvas and replaces transparent areas with white.</figcaption></figure>
<nav aria-label="Contents">
<p><strong>Contents</strong></p>
<ol>
<li><a href="#editor">Export one image in GIMP</a></li>
<li><a href="#background">Choose the background</a></li>
<li><a href="#command">Convert with ImageMagick</a></li>
<li><a href="#quality">Check the actual file</a></li>
<li><a href="#batch">Convert a folder</a></li>
<li><a href="#fixes">Find out why an upload fails</a></li>
<li><a href="#questions">Questions and a short check</a></li>
</ol>
</nav>
<h2 id="editor">How to save WebP as JPG in GIMP</h2>
<p>For one picture, I would use an editor with a preview. There is no need to delete the WebP when the export appears; I would keep it until the receiving app accepts the new copy. These are the English menu names in GIMP.</p>
<ol>
<li>Open the WebP. If you see a page or an error instead of the picture, check that the download really contains an image.</li>
<li>If the picture has transparent areas, add a solid-colour layer beneath it. Use the colour you want those areas to have in the JPEG.</li>
<li>Choose File → Export As. Enter a fresh filename ending in .jpg.</li>
<li>Confirm JPEG in the export dialog. Try quality 90 as a starting point, preview the result if available, then export.</li>
<li>Open the exported file separately. Check the edges and background, then select that copy in the upload form.</li>
</ol>
<p>Save and Export do different jobs in GIMP. Save keeps its editable XCF project; Export writes a copy for another application. If the form is asking for JPG and I have an XCF, I need Export As. Putting .jpg on the project’s filename would leave me with another misleading name.</p>
<p>The <a href="https://docs.gimp.org/3.0/en/file-jpeg-export.html">GIMP JPEG export guide</a> is useful for the preview and quality controls. I would treat 90 as a starting setting, then inspect the image. That number belongs to the encoder: 90 in another program need not look the same or produce the same number of bytes.</p>
<p>On a Mac, Preview has an Export command under File, with JPEG in the Format choices. I would first check that the installed version opens this particular WebP. If it does not, I would move to a WebP-capable editor or use the command below. Changing the extension cannot make an unreadable download open correctly.</p>
<h2 id="background">Choose the background before exporting</h2>
<p>The checkerboard is just a way of showing transparency in the illustration. It is not printed into the source badge. In the white JPEG, the corresponding pixels really are white, right out to the corners of the rectangular canvas.</p>
<p>That is why a white export shows a box on a dark page. The page did not add the box. I made the dark version by going back to the transparent WebP and choosing a different matte. Changing the web page’s background afterwards would not recolour the white pixels already in the JPEG.</p>
<figure><img loading="lazy" decoding="async" alt="The same North Pier badge appears on white and dark backgrounds in two JPEG exports." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-save-webp-as-jpg-background-choice.webp" style="display:block;max-width:100%;height:auto" width="1600"><figcaption>A JPEG background becomes part of the pixels, so choose a color that suits the destination.</figcaption></figure>
<p>For a badge that must sit on several backgrounds, I would keep a transparent copy as well. The <a href="https://libguides.uncw.edu/MakerStudio/design">UNC Wilmington image-format guide</a> describes PNG as useful for transparency and precise reproduction. When a form insists on JPEG, I still need an opaque delivery copy for that form.</p>
<p>The fine outline is where I would look closely. A partly transparent edge has to blend with the chosen matte too. Simply switching off the alpha channel can reveal colours that were hidden beneath the clear areas. In the command below I composite onto white before leaving the result opaque.</p>
<p>I would keep the transparent source even after the white version is accepted. If the next request is for a dark background, it is ready to export again. Erasing white from a compressed copy is a job I can avoid by keeping that source.</p>
<h2 id="command">Convert with ImageMagick</h2>
<p>I ran the following conversion with ImageMagick 7, using a build that reads WebP and writes JPEG. The terminal was in the folder containing <code style="background:#ffffff !important;color:#172331 !important">pier-badge.webp</code>. I gave the output a new name so the WebP stayed beside it.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d2dcdf;padding:18px"><code style="background:#ffffff !important;color:#172331 !important">magick pier-badge.webp -background white -alpha remove -alpha off -quality 90 pier-badge.jpg</code></pre>
<p>Reading that line from left to right, <code style="background:#ffffff !important;color:#172331 !important">pier-badge.webp</code> is the source and <code style="background:#ffffff !important;color:#172331 !important">-background white</code> supplies the matte. The <code style="background:#ffffff !important;color:#172331 !important">-alpha remove</code> step composites onto it; <code style="background:#ffffff !important;color:#172331 !important">-alpha off</code> leaves the result opaque. The .jpg output name requests JPEG encoding. The <a href="https://imagemagick.org/command-line-options/">ImageMagick option reference</a> explains those switches and the quality control.</p>
<p>I did not ask for a resize. The output remained 960 by 640 pixels, the same canvas as the source. For your own files, quote paths that contain spaces and choose an output name you can safely write. A new copy is of little use if it replaces another file you meant to keep.</p>
<p>I checked the frame selector separately with a red-and-blue animated WebP. Selecting frame zero produced one red JPEG. For this badge filename, the input would be <code style="background:#ffffff !important;color:#172331 !important">"pier-badge.webp[0]"</code>. A JPEG is a still, so I would keep the animated source if I needed the motion later.</p>
<p>If ImageMagick cannot read a source, I would look at the error and the installed format support before changing conversion settings. I would also check the download itself. A file called .webp may be incomplete or contain a web page, and neither is fixed by asking the converter to try harder.</p>
<h2 id="quality">Check what is inside the exported file</h2>
<p>After exporting, I asked ImageMagick what it had actually written. This check reports the encoded format and the width and height:</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d2dcdf;padding:18px"><code style="background:#ffffff !important;color:#172331 !important">magick identify -format '%m %wx%h' pier-badge.jpg</code></pre>
<p>The result for <code style="background:#ffffff !important;color:#172331 !important">pier-badge.jpg</code> was <code style="background:#ffffff !important;color:#172331 !important">JPEG 960x640</code>. For <code style="background:#ffffff !important;color:#172331 !important">renamed-only.jpg</code> it was <code style="background:#ffffff !important;color:#172331 !important">WEBP 960x640</code>. Same extension, same canvas, different encoding. The renamed copy also had exactly the same bytes as the source WebP.</p>
<p>If I had both in a file picker, I would give the export an unmistakable name before trying the upload again. The form may inspect the data as well as the extension. Selecting the renamed source again would take me back to the same problem.</p>
<div class="table-scroll">
<table>
<caption>The supplied badge files</caption>
<thead>
<tr>
<th scope="col">Copy</th>
<th scope="col">Decoded format</th>
<th scope="col">Dimensions</th>
<th scope="col">Bytes</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Original badge</th>
<td>WebP</td>
<td>960 × 640</td>
<td>4,260</td>
</tr>
<tr>
<th scope="row">Renamed copy</th>
<td>WebP</td>
<td>960 × 640</td>
<td>4,260</td>
</tr>
<tr>
<th scope="row">Quality 90 export</th>
<td>JPEG</td>
<td>960 × 640</td>
<td>63,416</td>
</tr>
<tr>
<th scope="row">Quality 25 export</th>
<td>JPEG</td>
<td>960 × 640</td>
<td>20,277</td>
</tr>
</tbody>
</table>
</div>
<p>The byte counts surprised nobody’s encoder: this is a flat drawing, and the lossless WebP stores it very compactly. Both JPEGs were larger. I would not use those figures to predict what will happen to a photograph; they describe this badge and these settings.</p>
<figure><img loading="lazy" decoding="async" alt="Matching enlarged crops of the North Pier badge show cleaner edges at JPEG quality 90 and stronger artifacts at quality 25." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-save-webp-as-jpg-quality-comparison.webp" style="display:block;max-width:100%;height:auto" width="1600"><figcaption>The smaller file has rougher edges here. These byte counts describe this sample, not a fixed saving for other images.</figcaption></figure>
<p>At quality 25, the letters have rougher edges. That buys a smaller file than quality 90, but I would judge the trade at the size the image will actually be used. The enlarged crops are there to make the difference easier to spot, not to suggest that everyone will view the badge that close.</p>
<p>I would make the next delivery copy from the WebP, not from my low-quality trial. A later high-quality save cannot bring back detail thrown away by an earlier lossy one. Keeping the trial separate makes it harder to mistake it for the master.</p>
<p>Changing format left my canvas alone. If the receiver needs fewer pixels, I have to resize a separate copy too. The guide to <a href="https://html5doctor.com/how-to-change-image-size-in-html/">changing image size</a> explains why that differs from making an image look smaller on a web page.</p>
<h2 id="batch">Convert a folder of WebP images</h2>
<p>I also ran this Bash loop with two source names, one containing spaces. It reads lowercase .webp files in the working folder and puts its JPEG copies in the jpg subfolder. The original WebPs stay where they are.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d2dcdf;padding:18px"><code style="background:#ffffff !important;color:#172331 !important">mkdir -p jpg
for source in ./*.webp; do
  [ -f "$source" ] || continue
  name=${source##*/}
  name=${name%.webp}
  magick "${source}[0]" -background white -alpha remove -alpha off -quality 90 "jpg/${name}.jpg"
done</code></pre>
<p>I would start with an empty jpg folder. Run it a second time and the same source names produce the same output names, so earlier JPEGs can be overwritten. It does not descend into subfolders, and uppercase .WEBP names are outside this particular match.</p>
<p>The selector takes frame zero from an animated source. Before using the loop on a large folder, I would open a few outputs, including one made from a transparent image. A matte that is right for one logo may be wrong for the next; a photograph may need a different quality setting.</p>
<h2 id="fixes">When the JPEG still will not upload</h2>
<div class="table-scroll">
<table>
<caption>Check the requirement the file is missing</caption>
<thead>
<tr>
<th scope="col">Problem</th>
<th scope="col">What to inspect</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">The form rejects the file</th>
<td>Its error message, actual encoding, pixel dimensions and byte limit</td>
</tr>
<tr>
<th scope="row">A rectangle surrounds the badge</th>
<td>The chosen matte; export again from the transparent source</td>
</tr>
<tr>
<th scope="row">Small text has noisy edges</th>
<td>A higher-quality copy, or PNG if the recipient accepts it</td>
</tr>
<tr>
<th scope="row">An animation has stopped</th>
<td>Whether the recipient needs an animated format instead of a JPEG still</td>
</tr>
<tr>
<th scope="row">The source cannot open</th>
<td>An incomplete download, wrong content or missing decoder support</td>
</tr>
</tbody>
</table>
</div>
<p>If my exported picture looked right but sat against the side of a web page, I would stop converting and look at the CSS. The <a href="https://html5doctor.com/how-to-center-an-image-in-html/">image-centering examples</a> deal with that layout problem. Another export would leave those alignment rules untouched.</p>
<p>For a private client image, I would prefer doing this locally. Using a conversion website means sending it a copy. I would read its storage and deletion terms before uploading the source, rather than assuming it disappears when the result is downloaded.</p>
<h2 id="questions">Questions and a short check</h2>
<h3>Is .jpeg different from .jpg?</h3>
<p>Both endings commonly refer to JPEG. I would use whichever the receiving app requests, while checking that the file actually contains JPEG data.</p>
<h3>Why did the JPG get bigger?</h3>
<p>The format does not promise a reduction. My flat badge is a good example: the lossless WebP is smaller than either JPEG. I would compare the actual copies and send the format the recipient needs.</p>
<h3>Can a JPG keep the transparent corners?</h3>
<p>No. I need to choose an opaque background for the JPEG. If I also need a cutout, I would keep a transparent source or a separate transparent delivery format.</p>
<details>
<summary>1. A .jpg file identifies as WEBP. What next?</summary>
<p>Open the source and export a real JPEG. The renamed copy still has WebP encoding.</p>
</details>
<details>
<summary>2. The dimensions are right but the file has too many bytes. What can you try?</summary>
<p>Lower JPEG quality and inspect the result. Resize only if the destination also allows fewer pixels.</p>
</details>
<details>
<summary>3. Can CSS recover the transparent corners from this white JPEG?</summary>
<p>The white is now part of the pixels. Return to the transparent source and use a suitable transparent format if you need those corners to remain clear.</p>
</details>
</div>
</div>
<p>The post <a href="http://html5doctor.com/how-to-save-webp-as-jpg/">How to Save WebP as JPG and Check the Export</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Font Pairing Guide: Which Fonts Go Together in CSS?</title>
		<link>http://html5doctor.com/font-pairing-guide-which-fonts-go-together-in-css/</link>
		
		<dc:creator><![CDATA[HTML5 Doctor]]></dc:creator>
		<pubDate>Wed, 11 Nov 2026 15:15:54 +0000</pubDate>
				<category><![CDATA[Elements]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6477</guid>

					<description><![CDATA[<p>My test line was “Fix it on Saturday”. At the same size, three bold faces needed roughly 473, 512 and 611 pixels to set those words. That difference is why I start a font pairing guide with the page’s actual text. For this repair cafe notice, Georgia above Arial is my starting pair. You can [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/font-pairing-guide-which-fonts-go-together-in-css/">Font Pairing Guide: Which Fonts Go Together in CSS?</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="h5d-guide">
<div class="h5d-guide">
<p>My test line was “Fix it on Saturday”. At the same size, three bold faces needed roughly 473, 512 and 611 pixels to set those words. That difference is why I start a font pairing guide with the page’s actual text. For this repair cafe notice, Georgia above Arial is my starting pair. You can reverse it, or use one family throughout, in the CSS example below.</p>
<p>I kept the invitation, instructions and opening time in each version. Save the two files, change one body class and compare them on your device. There is no font service to configure.</p>
<figure><img loading="lazy" decoding="async" src="https://html5doctor.com/wp-content/uploads/2026/11/font-pairing-css-heading-and-body-roles.webp" alt="Font pairing guide showing a bold Liberation Serif heading and Liberation Sans body text on a repair cafe notice." width="1600" height="900" style="display:block;max-width:100%;height:auto"><figcaption>Pair a distinct heading face with a body face you can read comfortably at paragraph size.</figcaption></figure>
<nav aria-label="Contents">
<p><strong>Contents</strong></p>
<ol>
<li><a href="#pick">Choose the jobs before the fonts</a></li>
<li><a href="#example">Build the repair cafe example</a></li>
<li><a href="#hierarchy">Try one family first</a></li>
<li><a href="#fallback">Find out what the fallback changes</a></li>
<li><a href="#diagnose">Fix a pairing that feels wrong</a></li>
<li><a href="#questions">Questions and a short exercise</a></li>
</ol>
</nav>
<h2 id="pick">Which fonts go together in CSS?</h2>
<p>I gave the invitation the display role and the lamp sentence the reading role. Somebody looking for the time has a different task from somebody glancing at the title. The instructions need to remain comfortable over several lines.</p>
<p>In the first illustration, Liberation Serif Bold supplies the invitation and Liberation Sans Regular supplies the instructions. Look at the finishing strokes on the big F, then at the plainer letters below. The stylesheet requests Georgia and Arial first, with those Liberation families as alternatives. The names in the illustration tell you which faces you are actually comparing there.</p>
<div class="table-scroll">
<table>
<caption>Four useful starting arrangements</caption>
<thead>
<tr>
<th scope="col">Page</th>
<th scope="col">Heading</th>
<th scope="col">Body</th>
<th scope="col">Try it on</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Article or newsletter</th>
<td>Georgia bold</td>
<td>Arial regular</td>
<td>The longest headline and a full paragraph</td>
</tr>
<tr>
<th scope="row">Essay or reference guide</th>
<td>Arial bold</td>
<td>Georgia regular</td>
<td>Paragraphs with italics and links</td>
</tr>
<tr>
<th scope="row">Form or account page</th>
<td>System sans bold</td>
<td>System sans regular</td>
<td>Labels, instructions and buttons</td>
</tr>
<tr>
<th scope="row">Technical tutorial</th>
<td>System sans bold</td>
<td>System sans regular</td>
<td>Ordinary text, with monospace reserved for code</td>
</tr>
</tbody>
</table>
</div>
<p>The table is a way into the comparison, rather than a set of pairings to memorise. I am quite happy to put two sans-serif families together if I can see what each contributes. The <a href="https://designsystem.cancer.gov/foundations/typography">National Cancer Institute’s design system</a> does that with Poppins headings and Open Sans body text and labels. Its Roboto Mono is reserved for code. Each choice has a visible purpose.</p>
<p>For this notice I have included “10 a.m.” in the sample. For a shop I would put in a price, perhaps “£18.95”. Those small bits of punctuation deserve a look at reading size. A handsome headline cannot tell me whether somebody will make sense of the opening time or price underneath it.</p>
<h2 id="example">Build the repair cafe example</h2>
<p>I have included the whole example so you can change the roles without rebuilding the page. Put <code style="background:#ffffff !important;color:#172331 !important">index.html</code> and <code style="background:#ffffff !important;color:#172331 !important">styles.css</code> in the same folder. The explanation of <a href="https://html5doctor.com/how-to-change-font-in-html/">how to change font in HTML</a> covers the family list if you want to understand that part before editing it.</p>
<h3>index.html</h3>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d2dcdf;padding:18px"><code style="background:#ffffff !important;color:#172331 !important">&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;title&gt;Saturday repair cafe&lt;/title&gt;
  &lt;link rel="stylesheet" href="styles.css"&gt;
&lt;/head&gt;
&lt;body class="pair-editorial"&gt;
  &lt;main&gt;
    &lt;h1&gt;Fix it on Saturday&lt;/h1&gt;
    &lt;p&gt;Bring a broken lamp or a loose chair leg.
      Volunteers can help you work out what to try next.&lt;/p&gt;
    &lt;h2 id="visit"&gt;Plan your visit&lt;/h2&gt;
    &lt;p&gt;Doors open at 10 a.m. Bring any parts you already have.&lt;/p&gt;
    &lt;p&gt;&lt;a href="#visit"&gt;Check the opening time&lt;/a&gt;&lt;/p&gt;
  &lt;/main&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<h3>styles.css</h3>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d2dcdf;padding:18px"><code style="background:#ffffff !important;color:#172331 !important">:root {
  --reading: Arial, "Liberation Sans", sans-serif;
  --display: var(--reading);
}

.pair-editorial {
  --display: Georgia, "Liberation Serif", serif;
}

.pair-reversed {
  --reading: Georgia, "Liberation Serif", serif;
  --display: Arial, "Liberation Sans", sans-serif;
}

body {
  margin: 0;
  color: #172331;
  background: #fff;
  font-family: var(--reading);
  font-size: 1.125rem;
  line-height: 1.6;
}

main {
  max-width: 62ch;
  margin-inline: auto;
  padding: 2rem 1rem;
}

h1, h2 {
  font-family: var(--display);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.5rem; }</code></pre>
<p>The first version is <code style="background:#ffffff !important;color:#172331 !important">pair-editorial</code>. Both headings use <code style="background:#ffffff !important;color:#172331 !important">--display</code>, so “Plan your visit” asks for the same face as the invitation. The instructions take <code style="background:#ffffff !important;color:#172331 !important">--reading</code> from the body. I have given each role its own list; a missing first-choice font does not make the title borrow the paragraph’s list.</p>
<p>The second version is <code style="background:#ffffff !important;color:#172331 !important">pair-reversed</code>. Change the class on the body, save the HTML and reload. Arial now leads the display list and Georgia leads the reading list. I have left the sizes alone: the 1.125rem body is 18px when the root size is 16px. Otherwise a change in size could make the new family seem more different than it is.</p>
<p>I also included a version without a body class. In <code style="background:#ffffff !important;color:#172331 !important">:root</code>, <code style="background:#ffffff !important;color:#172331 !important">--display</code> points to <code style="background:#ffffff !important;color:#172331 !important">--reading</code>; both roles therefore share the sans-serif stack. That gives you a baseline to return to after trying a few combinations. A second family has to improve on something, and this is the version to compare it with.</p>
<p>A completely unstyled page usually sends me back to the filenames first. Check the stylesheet’s name and its position beside the HTML. For a different folder arrangement, the guide to <a href="https://html5doctor.com/how-to-link-css-to-html/">linking CSS to HTML</a> explains how to write the path. The font comparison can wait until the stylesheet is loading.</p>
<p>Once the short invitation looks reasonable, give it a less convenient sentence: “Bring your broken lamps to the Saturday repair cafe”. That is the title I would use for a narrow-window check. Where does the final word land? I would allow another line or edit the copy before shrinking everything to save that one line.</p>
<h2 id="hierarchy">Try one family first</h2>
<p>The next comparison keeps the family fixed. On the left, “Plan your visit” is rather quiet above the opening time. On the right, it is larger and bold. I can see the section heading immediately without asking for another font.</p>
<figure><img loading="lazy" decoding="async" src="https://html5doctor.com/wp-content/uploads/2026/11/font-pairing-css-one-family-hierarchy.webp" alt="Two Liberation Sans notices compare a plain heading with a larger bold heading above identical body text." width="1600" height="900" style="display:block;max-width:100%;height:auto"><p></p>
<figcaption>Keep the body type unchanged while you adjust the size and weight of the heading.</figcaption>
</figure>
<p>Both panels use Liberation Sans, and the paragraph has the same treatment in each. Only the heading changes. For a short practical notice, that could be enough. I would keep this single-family version in the comparison rather than treating it as an unfinished design.</p>
<p>The HTML still needs to describe the heading properly. The <a href="https://designsystem.illinoisstate.edu/guidelines/typography/">Illinois State typography guidelines</a> explain its place in the document outline and its use for navigation. If my h2 looks too loud, I can make it quieter in CSS. I would keep it as an h2 while making that visual change.</p>
<p>I also compared a lowercase x in the bold specimen faces at 61 image pixels. Its visible ink was 28 pixels high in Liberation Serif and 32 in Liberation Sans. Equal type sizes gave me visibly different lowercase letters. For reading text, I would compare a paragraph as well: a single x tells me very little about following one line after another.</p>
<p>The column in the stylesheet has a maximum width of 62ch. The ch unit uses the zero glyph’s advance width in the relevant font, so it is not a count of ordinary letters. I cannot promise 62 characters per line from it. Changing the reading family can change the column width as well as the breaks within the paragraph.</p>
<h2 id="fallback">Find out what the fallback changes</h2>
<p>There are two jobs in my pairing and several possible faces in each stack. Suppose Georgia is absent from the title’s device. Its list continues to Liberation Serif and then the generic serif. Arial stays in the reading list. Keeping that distinction clear makes a missing font much easier to investigate.</p>
<p>The <a href="https://design.va.gov/foundation/design-tokens/typography">VA design system’s typography tokens</a> keep sans-serif lists for headings and body text, with monospace for code. Separate roles can share a first-choice family.</p>
<figure><img loading="lazy" decoding="async" src="https://html5doctor.com/wp-content/uploads/2026/11/font-pairing-css-fallback-line-wrap.webp" alt="The same repair cafe headline fits on one line in Liberation Sans Bold and wraps onto two in DejaVu Sans Bold." width="1600" height="900" style="display:block;max-width:100%;height:auto"><p></p>
<figcaption>Font widths can change wrapping even when the CSS size and available width stay the same.</figcaption>
</figure>
<p>Here are the two sans-serif measurements behind the wrapping comparison: about 512 pixels for Liberation Sans Bold and 611 for DejaVu Sans Bold. Each was set at 61 image pixels inside a 550-pixel line. The second face needs another line for “Saturday”. The words and size stayed fixed throughout that measurement.</p>
<p>You can make an intentionally awkward comparison in the browser by reducing the heading stack to <code style="background:#ffffff !important;color:#172331 !important">monospace</code>. See whether the extra line has room above the lamp instructions, then restore the original list. This temporary change is a way of finding tight spaces. It is not a recommendation to use monospace for the finished invitation.</p>
<p>Use the actual names, accents and scripts your page needs in the sample. One face can supply most of a name while a later face supplies a missing character. I would investigate that character before abandoning the pairing. Leave the final generic keyword unquoted in each stack.</p>
<p>For a downloaded font, I would compare a reload with caching disabled and a reload with the font request blocked. With <code style="background:#ffffff !important;color:#172331 !important">font-display: swap</code>, the first view can change from fallback to the arriving font; the blocked view stays in fallback. Watch the opening-time section below the title. A new line above it can move that section down.</p>
<h2 id="diagnose">Fix a pairing that feels wrong</h2>
<div class="table-scroll">
<table>
<caption>Start with the symptom you can see</caption>
<thead>
<tr>
<th scope="col">Symptom</th>
<th scope="col">Look at</th>
<th scope="col">First change to try</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">The headline disappears into the page</th>
<td>Size, weight and space above it</td>
<td>Strengthen the heading before adding a family</td>
</tr>
<tr>
<th scope="row">Changing the stack does nothing</th>
<td>The applied rule and the rendered font</td>
<td>Check the class, stylesheet and installed families</td>
</tr>
<tr>
<th scope="row">A line jumps as the font loads</th>
<td>Fallback width compared with the webfont</td>
<td>Allow another line and compare a closer fallback</td>
</tr>
<tr>
<th scope="row">One name looks different</th>
<td>Glyph coverage for those characters</td>
<td>Choose coverage appropriate to the script</td>
</tr>
</tbody>
</table>
</div>
<p>The requested family list alone cannot tell me what drew the letters. If your browser offers rendered-font information, inspect the invitation and the lamp sentence separately. Reading the original list again under computed styles is useful for checking the rule, but it does not establish that every requested face was present.</p>
<p>Enlarge the text, narrow the window and use Tab to reach the opening-time link. I want a visible focus and readable words. For a form, repeat with the longest real label.</p>
<h2 id="questions">Questions and a short exercise</h2>
<h3>Must a heading be serif and a paragraph sans-serif?</h3>
<p>No fixed order is needed. Read the lamp paragraph in the reversed and single-family versions. Your favourite arrangement for the invitation may not suit several lines of instructions.</p>
<h3>Will the same CSS look identical on every device?</h3>
<p>Installed fonts, text settings and available width can differ. The invitation can take another line; somebody should still be able to read what to bring and find the time.</p>
<h3>Check your changes</h3>
<details>
<summary>1. How would you put Arial on the headings and Georgia on the instructions?</summary>
<p>Use pair-reversed as the body class. Its two custom properties override the role assignments for this version of the notice.</p>
</details>
<details>
<summary>2. There is no Georgia on the device. Which list supplies the heading?</summary>
<p>The heading keeps its own list: Liberation Serif comes next, followed by the generic serif. Arial being named for the body does not move it into the heading list.</p>
</details>
<details>
<summary>3. Saturday drops below the rest of the invitation. Has the font size necessarily changed?</summary>
<p>No. The two faces in the specimen have different letter widths at the same size. Check that the extra line stays visible and leaves enough room for the instructions below.</p>
</details>
</div>
</div>
<p>The post <a href="http://html5doctor.com/font-pairing-guide-which-fonts-go-together-in-css/">Font Pairing Guide: Which Fonts Go Together in CSS?</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Add Canonical Tag in HTML: Examples and Checks</title>
		<link>http://html5doctor.com/how-to-add-canonical-tag-in-html/</link>
		
		<dc:creator><![CDATA[Steve Faulkner]]></dc:creator>
		<pubDate>Wed, 11 Nov 2026 13:32:49 +0000</pubDate>
				<category><![CDATA[Quick Tips]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6460</guid>

					<description><![CDATA[<p>To add a canonical tag in HTML, put &#60;link rel="canonical" href="https://example.com/preferred-page/"&#62; inside the document’s &#60;head&#62;. Replace the example address with the full URL you want search engines to treat as the preferred version. Add the same self-referencing link on that preferred page. Say you send out a campaign link to your seedling guide. It has [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/how-to-add-canonical-tag-in-html/">How to Add Canonical Tag in HTML: Examples and Checks</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="h5d-guide">
<div class="h5d-guide">
<p>To add a canonical tag in HTML, put <code style="background:#ffffff !important;color:#172331 !important;text-shadow:none !important;">&lt;link rel="canonical" href="https://example.com/preferred-page/"&gt;</code> inside the document’s <code style="background:#ffffff !important;color:#172331 !important;text-shadow:none !important;">&lt;head&gt;</code>. Replace the example address with the full URL you want search engines to treat as the preferred version. Add the same self-referencing link on that preferred page.</p>
<p>Say you send out a campaign link to your seedling guide. It has a tracking parameter, but the guide is exactly the same as the one at the clean address. You now have two URLs for one piece of content. A canonical lets you state which address you prefer. It leaves the campaign page available to visitors.</p>
<figure><img decoding="async" alt="How to add a canonical tag in HTML illustrated by duplicate page URLs pointing to one preferred address." class="wp-image-6437" height="900" loading="eager" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-add-canonical-tag-in-html-preferred-url.webp" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/how-to-add-canonical-tag-in-html-preferred-url.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-add-canonical-tag-in-html-preferred-url-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-add-canonical-tag-in-html-preferred-url-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-add-canonical-tag-in-html-preferred-url-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-add-canonical-tag-in-html-preferred-url-1536x864.webp 1536w" sizes="(max-width: 1600px) 100vw, 1600px" /><figcaption>Duplicate URLs can point to one preferred page without redirecting the visitor.</figcaption></figure>
<nav aria-label="Contents">
<p><strong>Contents</strong></p>
<ol>
<li><a href="#add-tag">Add the tag step by step</a></li>
<li><a href="#example">Complete HTML example</a></li>
<li><a href="#choose">Choose the right canonical URL</a></li>
<li><a href="#cms">WordPress and templates</a></li>
<li><a href="#check">Verify the result</a></li>
<li><a href="#mistakes">Common mistakes</a></li>
<li><a href="#faq">Frequently asked questions</a></li>
<li><a href="#quiz">Quick self-check</a></li>
</ol>
</nav>
<h2 id="add-tag">How to add a canonical tag in HTML, step by step</h2>
<ol>
<li>Open the HTML document or the template that produces its head.</li>
<li>Choose the preferred public address for this content.</li>
<li>Look for an existing canonical link before adding anything.</li>
<li>Add one link element inside head, using the full HTTPS address.</li>
<li>Save, deploy and inspect the HTML actually returned by the website.</li>
</ol>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;overflow-x:auto;line-height:1.6;"><code style="background:#ffffff !important;color:#172331 !important;text-shadow:none !important;">&lt;link rel="canonical" href="https://example.com/guides/seedlings/"&gt;</code></pre>
<p>Notice the element name: link. This is not a meta tag, and it is not a clickable link in your article. The rel attribute says what relationship you are declaring; href gives the destination. If you open a page and immediately arrive somewhere else, look for a redirect. The canonical link itself did not move you.</p>
<p>Copy the full public address, starting with https:// and your hostname. Check the path too. Does the working address end in a slash? Does it include www? Use the spelling you actually serve. Leave off fragments such as #watering, which refer to a place inside a page. A filename sitting on your laptop is not enough to establish the public URL.</p>
<figure><img decoding="async" alt="HTML document diagram places a canonical link inside head and visible page content inside body." class="wp-image-6438" height="900" loading="lazy" src="https://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-html-head-placement.webp" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-html-head-placement.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-html-head-placement-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-html-head-placement-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-html-head-placement-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-html-head-placement-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /></p>
<figcaption>The canonical link belongs in the document head, outside the visible article body.</figcaption>
</figure>
<h2 id="example">A complete HTML example with a canonical link</h2>
<p>For this example, the clean address is https://example.com/guides/seedlings/. A campaign adds ?campaign=spring without changing the guide. Both versions should contain the canonical declaration below. The clean page points to itself, while the campaign version points to the clean page. Neither needs a different visible heading or paragraph just because its URL differs.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;overflow-x:auto;line-height:1.6;"><code style="background:#ffffff !important;color:#172331 !important;text-shadow:none !important;">&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;title&gt;When to move seedlings outside&lt;/title&gt;
  &lt;link rel="canonical" href="https://example.com/guides/seedlings/"&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;main&gt;
    &lt;h1&gt;When to move seedlings outside&lt;/h1&gt;
    &lt;p&gt;Introduce seedlings to outdoor conditions gradually.&lt;/p&gt;
  &lt;/main&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>You can save this document locally and open it to inspect the structure. It will display the short seedling note, not send you to example.com. That domain is a placeholder. Before deploying the pattern, substitute the address of your own published guide. Otherwise, you would be making a preference declaration about somebody else’s address.</p>
<p>For a real example of choosing between equivalent addresses, <a href="https://www.northwestern.edu/web-resources/site-optimization/web-search/seo-technical-best-practices.html">Northwestern University’s technical SEO guidance</a> describes preferring its homepage without index.html over the equivalent address containing that filename. The content is the same; the preferred public spelling is clearer.</p>
<p>Metadata also needs useful surrounding content. Our guide to <a href="https://html5doctor.com/how-to-add-seo-keywords-in-html/">adding SEO keywords in HTML</a> explains titles, headings and descriptions. A canonical answers which URL represents the page; it cannot repair a vague title or an incomplete explanation.</p>
<h2 id="choose">Choose the right canonical URL before editing</h2>
<p>What if the parameter changes the content? Stop and compare the pages. A campaign code may leave everything intact, whereas a filter can produce a different list of products. Two product pages might look almost identical because they share a template, yet describe different products. Similar URLs and similar design do not, on their own, make the content duplicated.</p>
<div aria-label="Canonical decisions" role="region" style="overflow-x:auto" tabindex="0">
<table>
<caption>Which approach fits the situation?</caption>
<thead>
<tr>
<th scope="col">Situation</th>
<th scope="col">Starting choice</th>
<th scope="col">Reason</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Tracking URL, unchanged article</th>
<td>Canonical to the clean article</td>
<td>The content is duplicated.</td>
</tr>
<tr>
<th scope="row">Original standalone article</th>
<td>Self-referencing canonical</td>
<td>States the preferred address.</td>
</tr>
<tr>
<th scope="row">Old page permanently replaced</th>
<td>Consider a permanent redirect</td>
<td>Visitors should reach the replacement.</td>
</tr>
<tr>
<th scope="row">Different product or article</th>
<td>Its own canonical</td>
<td>Unique content deserves its own identity.</td>
</tr>
<tr>
<th scope="row">Page two of a listing</th>
<td>Usually its own canonical</td>
<td>Page one may not contain its items.</td>
</tr>
</tbody>
</table>
</div>
<p>The underlying <a href="https://www.rfc-editor.org/info/rfc6596/">canonical link relation in RFC 6596</a> describes a preferred resource for duplicated content and warns against confusing targets, chains and error pages. In particular, a later component page should not point to page one when page one lacks its content. A suitable view-all page is a different case.</p>
<p>Follow the destination before you declare it. You want the intended public content, not a login screen, an error or a trail of redirects. Then read that page’s own canonical. A points to B, but B points to C? Work out which address really represents the content and simplify the mapping. Your navigation and sitemap should agree with that choice.</p>
<p>URL routing matters too. <a href="https://developers.cloudflare.com/workers/static-assets/routing/advanced/html-handling/">Cloudflare’s HTML-handling documentation</a> shows how static-asset settings control redirects and rewrites for file extensions and trailing slashes. Check your hosting platform’s actual behaviour before choosing between a slash, an HTML filename or an extensionless address. A file path and a served URL are not always identical.</p>
<h2 id="cms">Add canonicals through WordPress or a template</h2>
<p>Already using WordPress? View the source before adding a snippet. Your SEO plugin or site may have done the job already. One correct self-referencing declaration is enough. A second plugin, a page-builder field and a theme snippet can all produce their own versions; adding more code can create the very conflict you were trying to fix.</p>
<p>Use the supported canonical URL setting when you need an override. Save it, then check what the website outputs. Do not paste the head-only link into a normal post block and assume the job is done. That editor controls the body. Your declaration needs to appear in the document head, whichever setting or template produces it.</p>
<p>A shared template needs a per-page value. Hard-coding the homepage is an easy way to give every article the wrong destination. After changing the template, check an article, a category and an older page rather than stopping at the page you had open during development. An error in a shared head can reach the whole archive.</p>
<p>Also check the hostname after copying a staging configuration. Is the production page still declaring a preview host as canonical? Build the address from trusted site configuration and the content’s own path, and escape the attribute value properly. Do not let an arbitrary request parameter choose the canonical host. A convenient test setting should not become a public preference by accident.</p>
<h2 id="check">Verify the canonical declaration and the result</h2>
<figure><img decoding="async" alt="Three canonical checks compare page source, the target response and the search engine selected URL." class="wp-image-6439" height="900" loading="lazy" src="https://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-verification-workflow.webp" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-verification-workflow.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-verification-workflow-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-verification-workflow-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-verification-workflow-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/canonical-tag-verification-workflow-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /></p>
<figcaption>A correct declaration, a healthy target and a search engine’s selected canonical are separate checks.</figcaption>
</figure>
<ol>
<li><strong>Inspect source.</strong> Open the deployed page, view its source and search for canonical. Confirm the link sits in head and has the expected absolute URL.</li>
<li><strong>Check duplication.</strong> Look for a second declaration from another plugin or a canonical HTTP Link header that disagrees.</li>
<li><strong>Open the target.</strong> Confirm the response, content and final address. Inspect the preferred page’s own canonical too.</li>
<li><strong>Check selection.</strong> In Google Search Console, inspect the indexed URL information and compare the user-declared and Google-selected canonicals when available.</li>
</ol>
<p>The live page and the indexed record answer different questions. A new pull from your server will show you what your server is sending out today. Your index entry shows a processed version of your work that might not have included your last update. If these don&#8217;t match up, please verify how you implemented the change and give yourself time for the search engines to crawl again before you take the older record as evidence that the edit did not succeed.</p>
<p>The browser console can give you a quick list of canonical destinations in the current DOM. Run this on your own page and compare the result with the address you intended. An empty list or an unexpected second result is worth investigating. The command does not inspect response headers, test the target or tell you what a search engine selected.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;overflow-x:auto;line-height:1.6;"><code style="background:#ffffff !important;color:#172331 !important;text-shadow:none !important;">Array.from(document.querySelectorAll('link[rel~="canonical"]'))
  .map(link =&gt; link.href);</code></pre>
<p>If markup has slipped out of head because an earlier tag is malformed, fix the document before adding more SEO code. Our <a href="https://html5doctor.com/how-to-debug-and-validate-html/">HTML debugging and validation workflow</a> helps trace structural mistakes. A valid-looking string inside a broken document is not enough.</p>
<h2 id="mistakes">Common canonical mistakes and practical fixes</h2>
<p>Before altering templates, map each source URL to its preferred destination. Record why they belong together and leave space for verification. Ten rows pointing to one URL should make you pause: are they duplicates, or did a shared setting send everything to the homepage?</p>
<p>Try one representative page and a duplicate variant first. Keep the working template. After deployment, inspect both URLs, then a page outside that group. It should still identify its own preferred address. Extend the change across the archive only after these checks pass.</p>
<p>Keep observations separate from expectations. “The source contains one canonical pointing to the clean guide” is an observation. “Google will select that guide” remains an expectation until indexed information confirms it. This distinction helps you avoid repeatedly editing correct markup while waiting for processing.</p>
<p>After removing a conflicting snippet, inspect representative page types. You might fix a duplicate declaration on one template and remove the only declaration on another. Keep the URL map with deployment notes so the next maintainer knows why an override exists.</p>
<div aria-label="Canonical troubleshooting" role="region" style="overflow-x:auto" tabindex="0">
<table>
<caption>Find the cause before changing the URL again</caption>
<thead>
<tr>
<th scope="col">Problem</th>
<th scope="col">What to check</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Two canonical elements</th>
<td>Identify which theme or plugin produces each; keep one owner.</td>
</tr>
<tr>
<th scope="row">Everything points to home</th>
<td>Fix the shared template to output each page’s intended URL.</td>
</tr>
<tr>
<th scope="row">Target returns 404</th>
<td>Correct the mapping or restore the intended content.</td>
</tr>
<tr>
<th scope="row">Search selects another URL</th>
<td>Compare content, redirects, internal links and indexed information.</td>
</tr>
<tr>
<th scope="row">Change absent from source</th>
<td>Check deployment and caches before assuming the saved setting failed.</td>
</tr>
</tbody>
</table>
</div>
<p>Robots.txt is not a place to nominate your preferred URL. If you block a duplicate from crawling, a crawler may be unable to read the canonical inside it. Noindex is a different decision again: excluding a page is not the same as choosing which duplicate represents it. Decide what you want indexed before combining settings that send conflicting signals.</p>
<p>A tag on your website cannot make another publisher change theirs. If somebody copies your content, do not assume a canonical solves that problem or proves ownership. It does not guarantee better rankings either. Check the implementation you control and treat copying as a separate issue.</p>
<h2 id="faq">Frequently asked questions</h2>
<h3>Is a canonical tag a meta tag?</h3>
<p>It is often called one, but look at the code: the element is link, with rel and href attributes. It belongs in head alongside the document’s other metadata.</p>
<h3>Does every page need to point to the homepage?</h3>
<p>No. Give a distinct article its own preferred address. The homepage is not a substitute for an article’s unique content. A declaration pointing there may simply be ignored.</p>
<h3>Can a canonical point to another domain?</h3>
<p>Yes, the link relation permits a cross-domain preference. That is a deliberate choice, not a routine fix for two addresses on your own site. Verify that the content genuinely matches and check current search-engine guidance. Be especially careful about declaring somebody else’s page as the preferred version of your work.</p>
<h2 id="quiz">Quick self-check</h2>
<p>Try answering these before revealing the explanations. Each question uses a native disclosure control, with no custom script required.</p>
<details>
<summary>Where does the HTML canonical link belong?</summary>
<p>Inside head, not in the article body. It describes the document rather than visible article content.</p>
</details>
<details>
<summary>Will adding it redirect a visitor?</summary>
<p>No. It expresses a preferred resource; a redirect is a separate response mechanism.</p>
</details>
<details>
<summary>Can every product point to the shop homepage?</summary>
<p>No. Shared design does not make different product content equivalent. Choose a destination that genuinely represents the content.</p>
</details>
</div>
</div>


<p class="wp-block-paragraph"></p>
<p>The post <a href="http://html5doctor.com/how-to-add-canonical-tag-in-html/">How to Add Canonical Tag in HTML: Examples and Checks</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Change Font Size in HTML With CSS</title>
		<link>http://html5doctor.com/how-to-change-font-size-in-html/</link>
		
		<dc:creator><![CDATA[Steve Faulkner]]></dc:creator>
		<pubDate>Tue, 10 Nov 2026 13:14:46 +0000</pubDate>
				<category><![CDATA[Quick Tips]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6467</guid>

					<description><![CDATA[<p>When I was putting together the example for this guide, “Your collection is ready” was the line I wanted to draw attention to. I left the order number instructions alone and changed the message from the page’s usual 1rem to 1.25rem. That’s how to change font size in HTML without resizing the whole page. Put [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/how-to-change-font-size-in-html/">How to Change Font Size in HTML With CSS</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="h5d-guide">
<div class="h5d-guide">
<p>When I was putting together the example for this guide, “Your collection is ready” was the line I wanted to draw attention to. I left the order number instructions alone and changed the message from the page’s usual <code style="background:#ffffff !important;color:#172331 !important">1rem</code> to <code style="background:#ffffff !important;color:#172331 !important">1.25rem</code>. That’s how to change font size in HTML without resizing the whole page. Put the CSS <code style="background:#ffffff !important;color:#172331 !important">font-size</code> on the element with the words you want to change.</p>
<p>I’ve also made a copy with the old style in the wrong place. It shows how a good CSS rule can appear to do nothing.</p>
<figure><img loading="lazy" decoding="async" alt="The same collection notice at 16px, 20px and 24px shows how to change font size in HTML with rem values." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-css-size-scale.webp" class="wp-image-6464" style="display:block;max-width:100%;height:auto" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-css-size-scale.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-css-size-scale-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-css-size-scale-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-css-size-scale-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-css-size-scale-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>At a 16px root, these rem sizes compute to 16px, 20px and 24px.</figcaption></figure>
<nav aria-label="Contents">
<p><strong>Contents</strong></p>
<ol>
<li><a href="#one">Change one paragraph</a></li>
<li><a href="#page">Try the complete page</a></li>
<li><a href="#units">Choose rem, em or pixels</a></li>
<li><a href="#responsive">Make headings responsive</a></li>
<li><a href="#part">Resize part of a sentence</a></li>
<li><a href="#fix">Fix a size that will not change</a></li>
<li><a href="#readable">Check enlarged text</a></li>
<li><a href="#questions">Questions and self-check</a></li>
</ol>
</nav>
<h2 id="one">How to change font size in HTML on one line</h2>
<p>Start with the little experiment I used to pick the size. Drop this paragraph inside <code style="background:#ffffff !important;color:#172331 !important">body</code> and open the page. The <code style="background:#ffffff !important;color:#172331 !important">style</code> attribute affects this particular paragraph, which makes it a handy place to try a couple of values.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;p style="font-size: 1.25rem;"&gt;Your collection is ready.&lt;/p&gt;</code></pre>
<p>Four extra pixels, if the root is 16px. With a 20px root, it’s five. A <code style="background:#ffffff !important;color:#172331 !important">rem</code> uses the font size of the root element, normally <code style="background:#ffffff !important;color:#172331 !important">html</code>, so I can work out the change as soon as I know that size.</p>
<p>I wouldn’t want a copy of that declaration on every ready-for-collection message. I moved the size into a class when I built the whole page. Give the class to a second paragraph and the same rule will reach it too.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;p class="notice"&gt;Your collection is ready.&lt;/p&gt;</code></pre>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">.notice {
  font-size: 1.25rem;
  line-height: 1.6;
}</code></pre>
<p>In the tag, the class name is <code style="background:#ffffff !important;color:#172331 !important">notice</code>. The dot in <code style="background:#ffffff !important;color:#172331 !important">.notice</code> tells CSS to look for a class. The line height gives the message space if it wraps.</p>
<p>I kept the CSS inside <code style="background:#ffffff !important;color:#172331 !important">style</code> so this page fits in one file. For several pages I’d use a common file and follow the <a href="https://html5doctor.com/how-to-link-css-to-html/">HTML5 Doctor guide to linking a stylesheet</a>.</p>
<h2 id="page">Try the complete collection notice page</h2>
<p>Save this as <code style="background:#ffffff !important;color:#172331 !important">collection.html</code> and open it in a browser. If the code appears as plain text, check that your editor didn’t add <code style="background:#ffffff !important;color:#172331 !important">.txt</code> to the filename. I kept the heading at <code style="background:#ffffff !important;color:#172331 !important">2rem</code> and the instructions at <code style="background:#ffffff !important;color:#172331 !important">1rem</code> for comparison.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;title&gt;Collection notice&lt;/title&gt;
  &lt;style&gt;
    html { font-size: 100%; }
    body { margin: 2rem; font-family: system-ui, sans-serif;
           font-size: 1rem; line-height: 1.6; color: #172331; }
    main { max-width: 40rem; }
    h1 { font-size: 2rem; line-height: 1.2; }
    .notice { font-size: 1.25rem; }
    button { font: inherit; padding: 0.6em 1em; }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;main&gt;
    &lt;h1&gt;Collect your order&lt;/h1&gt;
    &lt;p class="notice"&gt;Your collection is ready.&lt;/p&gt;
    &lt;p&gt;Bring your order number to the collection desk.&lt;/p&gt;
    &lt;button type="button" onclick="window.print()"&gt;Print this notice&lt;/button&gt;
  &lt;/main&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>The print control is useful here. An enlarged paragraph can push it down, which is fine as long as you can still reach it. Pressing the button asks the browser to print the page. Cancel the dialog when you’re done with it.</p>
<p>I made my edit in a copy called <code style="background:#ffffff !important;color:#172331 !important">collection-larger.html</code>. In <code style="background:#ffffff !important;color:#172331 !important">.notice</code>, change <code style="background:#ffffff !important;color:#172331 !important">1.25rem</code> to <code style="background:#ffffff !important;color:#172331 !important">1.5rem</code>. Save and reload. With a 16px root, the notice should go from 20px to 24px and the order number instruction should stay at 16px.</p>
<p>Check <code style="background:#ffffff !important;color:#172331 !important">font-size</code> under Computed for both paragraphs. If your numbers differ, check the root’s font size before you change the rule. I set <code style="background:#ffffff !important;color:#172331 !important">html</code> to 100% so it can follow the default. A 20px root makes the original <code style="background:#ffffff !important;color:#172331 !important">1.25rem</code> notice 25px.</p>
<p>On this page I can still keep all three sizes in my head. For a site where they need to be shared and named, the <a href="https://designsystem.digital.gov/design-tokens/typesetting/font-size/">U.S. Web Design System font scale</a> shows how a set of type sizes can be expressed in rem.</p>
<h2 id="units">When I use rem and when I use em</h2>
<p>Suppose the notice appears on two pages with different body text. A <code style="background:#ffffff !important;color:#172331 !important">rem</code> rule keeps the two notices the same size if the root is the same. If I want each message a quarter bigger than the text in its own card, I use <code style="background:#ffffff !important;color:#172331 !important">1.25em</code>.</p>
<div aria-label="Common font-size units" class="table-scroll" role="region" tabindex="0">
<table>
<caption>Common font-size units</caption>
<thead>
<tr>
<th scope="col">Unit</th>
<th scope="col">Reference for font-size</th>
<th scope="col">Example</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">rem</th>
<td>The root element’s font size</td>
<td>1.25rem is 20px when the root is 16px</td>
</tr>
<tr>
<th scope="row">em</th>
<td>The parent’s computed font size</td>
<td>1.25em is 25px when the parent is 20px</td>
</tr>
<tr>
<th scope="row">%</th>
<td>The parent’s computed font size</td>
<td>125% has the same multiplier as 1.25em here</td>
</tr>
<tr>
<th scope="row">px</th>
<td>A CSS pixel length</td>
<td>20px stays 20 CSS pixels regardless of parent text size</td>
</tr>
</tbody>
</table>
</div>
<p>I use <code style="background:#ffffff !important;color:#172331 !important">px</code> when I need a fixed CSS measurement. Page zoom can still enlarge it. When I want the default font size to affect the result, I pick a relative unit.</p>
<p>The <a href="https://ubwp.buffalo.edu/art320/exercises/exercise-3-building-a-site-with-html-and-css/exercise-3-part-3-responsive-css/">University at Buffalo lesson on responsive font sizing</a> covers how these units respond. Pay attention to the property being set. In a <code style="background:#ffffff !important;color:#172331 !important">font-size</code> declaration, an em is based on the parent’s computed font size. If I use em for padding, it’s based on the font size of the element with the padding.</p>
<p>For a closer look, put one label inside another. Both get <code style="background:#ffffff !important;color:#172331 !important">font-size: 1.25em</code>, and their starting parent is 16px.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">.outer { font-size: 1.25em; }
.inner { font-size: 1.25em; }</code></pre>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;div class="outer"&gt;Outer text
  &lt;span class="inner"&gt;Inner text&lt;/span&gt;
&lt;/div&gt;</code></pre>
<p>The outer text gets 20px. That’s the starting point for the inner rule, which multiplies again to give 25px. If I change both units to rem, there’s no second step in the calculation. Each uses the 16px root and comes out at 20px.</p>
<figure><img loading="lazy" decoding="async" alt="Comparison of a 16px base with nested 1.25em sizes of 20px and 25px, versus 1.25rem sizes of 20px each." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-em-rem-inheritance.webp" class="wp-image-6465" style="display:block;max-width:100%;height:auto" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-em-rem-inheritance.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-em-rem-inheritance-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-em-rem-inheritance-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-em-rem-inheritance-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-em-rem-inheritance-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>For font size, em uses the parent and rem uses the root.</figcaption></figure>
<h2 id="responsive">The heading has a size range</h2>
<p>The notice needs a straightforward size. The heading is where I tried a responsive one. I made another copy and used <code style="background:#ffffff !important;color:#172331 !important">clamp()</code> so it can gain size on a wide page but has somewhere to stop. The middle expression adds a little viewport width to a root-relative value.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">h1 {
  font-size: clamp(1.75rem, 1.25rem + 2vw, 3rem);
  line-height: 1.2;
}</code></pre>
<p>Here’s what the calculation gives at a 16px root for three widths: 360px, 1000px and 1600px. At the first width, the middle expression gives 27.2px and the minimum raises it to 28px. At the middle width, 40px fits between the limits. At the last width, the preferred size reaches 52px and the upper limit brings it back to 48px.</p>
<p>Before picking those numbers for a shop, I’d add “at the Riverside branch” to the heading. Narrow the window and try zoom. The title needs room to wrap above the notice.</p>
<p>Leave pinch zoom available. A heading can use another line on a narrow phone. Check the actual heading at 200% zoom, since the viewport part of the formula can offset some of the enlargement.</p>
<h2 id="part">When just a few words need to grow</h2>
<p>When only “ready for collection” needs to grow, I put a <code style="background:#ffffff !important;color:#172331 !important">span</code> around that phrase and give the span a class.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;p&gt;Your order is &lt;span class="status"&gt;ready for collection&lt;/span&gt;.&lt;/p&gt;</code></pre>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">.status { font-size: 1.1em; }
button, input, select, textarea { font: inherit; }</code></pre>
<p>I used <code style="background:#ffffff !important;color:#172331 !important">1.1em</code>, so the phrase gets ten percent more than the surrounding text. If the words also convey stress or importance, I’d choose <code style="background:#ffffff !important;color:#172331 !important">em</code> or <code style="background:#ffffff !important;color:#172331 !important">strong</code> for the markup and use CSS for the visual size.</p>
<p>The button is another element worth inspecting. I set <code style="background:#ffffff !important;color:#172331 !important">font: inherit</code> so it uses the surrounding font, and used em padding so the space grows with the label. Enlarging just the notice paragraph leaves the separate button at its inherited size. Enlarging the body text can affect the button too.</p>
<p>Two typefaces at 20px can have differently sized lowercase letters. The <a href="https://html5doctor.com/how-to-change-font-in-html/">HTML5 Doctor guide to changing fonts</a> shows how to check which family the browser picked.</p>
<h2 id="fix">What if my notice is still 20px?</h2>
<p>I put the first inline style back on the notice in a third file, <code style="background:#ffffff !important;color:#172331 !important">collection-inline-override.html</code>, while leaving the CSS class at 1.5rem. Both values are now present. The ordinary class rule loses to the inline declaration, so the expected computed size is 20px. Remove <code style="background:#ffffff !important;color:#172331 !important">style="font-size: 1.25rem;"</code> from the paragraph, keeping its class, and the class can take it to 24px.</p>
<div aria-label="Find the cause before adding another rule" class="table-scroll" role="region" tabindex="0">
<table>
<caption>Find the cause before adding another rule</caption>
<thead>
<tr>
<th scope="col">Symptom</th>
<th scope="col">Useful check</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">No visible change</th>
<td>Save the correct file, reload, check class and stylesheet request</td>
</tr>
<tr>
<th scope="row">Rule is crossed out</th>
<td>Find the winning declaration in the inspector</td>
</tr>
<tr>
<th scope="row">Nested text grows too much</th>
<td>Look for repeated em or percentage multipliers</td>
</tr>
<tr>
<th scope="row">Buttons look smaller</th>
<td>Check control font defaults and explicit overrides</td>
</tr>
<tr>
<th scope="row">Text clips after enlargement</th>
<td>Check fixed heights, overflow and constrained widths</td>
</tr>
</tbody>
</table>
</div>
<p>Select the paragraph in the inspector and expand its computed <code style="background:#ffffff !important;color:#172331 !important">font-size</code> to find the declaration. Try unticking the inline style there. Make the edit in the file afterwards, since inspector changes are temporary. If your class rule is missing, check its spelling and that the CSS loaded.</p>
<h2 id="readable">I make space for the longer notice</h2>
<p>Put “Please wait beside the green door at entrance 2” after the message and try the page at 200% zoom. Follow the notice to its final word, then press Tab to get to Print this notice. I use that longer wording to exercise the part of the layout that a short sentence can leave untouched.</p>
<p>The <a href="https://www.section508.gov/develop/fonts-typography/">Section 508 typography guidance</a> explains why the whole message and its controls need to stay usable when text grows. I check browser zoom and the default text size separately.</p>
<figure><img loading="lazy" decoding="async" alt="Illustrated comparison of enlarged notice text clipped by a fixed box and the same text wrapping inside a flexible box." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-enlarged-text-reflow.webp" class="wp-image-6466" style="display:block;max-width:100%;height:auto" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-enlarged-text-reflow.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-enlarged-text-reflow-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-enlarged-text-reflow-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-enlarged-text-reflow-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-font-size-in-html-enlarged-text-reflow-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>When text grows, let its container grow and keep the action reachable.</figcaption></figure>
<p>My line height of 1.6 gives a 20px notice 32px per line and a 24px notice 38.4px per line. At two lines, the difference is nearly 13px before I count margins or padding. I’d leave the height of the notice free to grow and check the print button again.</p>
<h2 id="questions">Questions and self-check</h2>
<h3>Can I use the old font size attribute?</h3>
<p>I move the size into CSS. The old <code style="background:#ffffff !important;color:#172331 !important">font</code> element is obsolete, and its numeric size scale does not map directly to CSS pixels.</p>
<h3>Does 16px guarantee readable text?</h3>
<p>It gives me a starting point for this example. I also check how the chosen font looks at the intended line length and whether there’s room for it to grow.</p>
<h3>Should I enlarge text by changing heading levels?</h3>
<p>I keep “Collect your order” as the page’s <code style="background:#ffffff !important;color:#172331 !important">h1</code>. If it needs to be smaller, I edit the CSS for that heading. The page still has the same structure.</p>
<h3>Check your understanding</h3>
<p>Open an answer after you’ve tried the calculation or decided which change you’d make.</p>
<details>
<summary>1. The root is 20px. How large is 1.5rem?</summary>
<p>30 CSS pixels. Multiply the 20px root by 1.5.</p>
</details>
<details>
<summary>2. Two nested elements each use 1.25em. Do they stay equal?</summary>
<p>With a 16px starting parent, the outer element is 20px and its child is 25px. The inner rule starts from the outer size.</p>
</details>
<details>
<summary>3. A button clips enlarged text. Should you shrink the text?</summary>
<p>I’d let the layout grow so the whole label remains available. Check the button again after removing a fixed height or restrictive overflow rule.</p>
</details>
</div>
</div>
<p>The post <a href="http://html5doctor.com/how-to-change-font-size-in-html/">How to Change Font Size in HTML With CSS</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>What Is Span in HTML? Examples, CSS and Common Mistakes</title>
		<link>http://html5doctor.com/what-is-span-in-html/</link>
		
		<dc:creator><![CDATA[Steve Faulkner]]></dc:creator>
		<pubDate>Mon, 09 Nov 2026 11:37:48 +0000</pubDate>
				<category><![CDATA[Quick Tips]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6443</guid>

					<description><![CDATA[<p>In HTML, span is a generic container for a word, phrase or other phrasing content. It gives you somewhere to attach a class, a language attribute or a script hook when no more meaningful element fits. By default, a span stays inline with the surrounding text. It does not make that text bold, colored or [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/what-is-span-in-html/">What Is Span in HTML? Examples, CSS and Common Mistakes</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="h5d-guide">
<div class="h5d-guide">
<p>In HTML, span is a generic container for a word, phrase or other phrasing content. It gives you somewhere to attach a class, a language attribute or a script hook when no more meaningful element fits. By default, a span stays inline with the surrounding text. It does not make that text bold, colored or clickable on its own.</p>
<p>Think of a collection notice that says, “Collect your order from the side door.” You want the location to stand out without turning it into a heading or a separate paragraph. A span can wrap just those three words. The rest of the sentence remains ordinary paragraph text.</p>
<figure><img decoding="async" alt="What is span in HTML: the side door wrapped inside an otherwise unchanged collection sentence." class="wp-image-6440" height="900" loading="eager" src="https://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-phrase-wrapper.webp" style="max-width:100%;height:auto" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-phrase-wrapper.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-phrase-wrapper-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-phrase-wrapper-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-phrase-wrapper-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-phrase-wrapper-1536x864.webp 1536w" sizes="(max-width: 1600px) 100vw, 1600px" /><figcaption>A span selects a small piece of text; the class supplies a styling hook.</figcaption></figure>
<nav aria-label="Contents">
<p><strong>Contents</strong></p>
<ol>
<li><a href="#meaning">What is span in HTML?</a></li>
<li><a href="#example">A complete example to try</a></li>
<li><a href="#choose">Span, div or a semantic element?</a></li>
<li><a href="#language">Mark a phrase in another language</a></li>
<li><a href="#layout">Understand inline layout</a></li>
<li><a href="#trouble">Troubleshoot a stubborn span</a></li>
<li><a href="#questions">Questions and self-check</a></li>
</ol>
</nav>
<h2 id="meaning">What is span in HTML?</h2>
<p>A span groups content without assigning it a particular meaning. The surrounding paragraph is still a paragraph; the wrapped location is not automatically an address, a warning or a link. You supply an attribute when you need one, then CSS or JavaScript can select that element.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;p&gt;Collect your order from &lt;span class="pickup"&gt;the side door&lt;/span&gt;.&lt;/p&gt;</code></pre>
<p>The opening tag begins the wrapper. The closing tag ends it after “door,” leaving the full stop outside. This is a small boundary, but it decides which characters get styled. Forget the closing tag and later words may receive a style you intended for only the location.</p>
<p>The class name is pickup, without a dot in the HTML. A CSS class selector uses the dot. Put the following rule in your stylesheet or inside a style element in the document head:</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">.pickup {
  color: #145545;
  background-color: #e8f4ec;
  padding-inline: 0.2em;
}</code></pre>
<p>You should get dark green words on a pale green background. Remove the rule and the wrapper remains in the document, but the words look ordinary again. That is a useful first experiment: it separates the HTML grouping from its visual treatment.</p>
<p>Choose a class name for the content’s purpose. If the color changes next month, pickup will still make sense. A name such as green-text becomes misleading. <a href="https://www.cs.dartmouth.edu/fwp/notes/session-02/">Dartmouth’s CSS fundamentals notes</a> explain this naming approach and the distinction between a reusable class and a unique identifier.</p>
<h2 id="example">A complete example to try</h2>
<p>Save this document as pickup.html in a plain-text editor, then open it in your browser. It needs no downloaded fonts, JavaScript or server. There are three different decisions in the body: a styled location, a phrase marked as Spanish, and an important instruction.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;title&gt;Pickup instructions&lt;/title&gt;
  &lt;style&gt;
    body { font-family: system-ui, sans-serif; line-height: 1.6;
           margin: 2rem; color: #172331; background: #ffffff; }
    .pickup { color: #145545; background: #e8f4ec;
              padding-inline: 0.2em; }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;h1&gt;Collecting your order&lt;/h1&gt;
  &lt;p&gt;Collect your order from &lt;span class="pickup"&gt;the side door&lt;/span&gt;.&lt;/p&gt;
  &lt;p&gt;Ask for &lt;span lang="es"&gt;la caja&lt;/span&gt;, meaning the box.&lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;Bring your order number.&lt;/strong&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>Start by checking the location. Only “the side door” should have the green treatment. The Spanish phrase should remain ordinary-looking text. The order-number instruction will normally appear bold because it uses strong, not because every span is bold.</p>
<p>Now move the first closing span tag to just before the word “door.” Save and reload. You should see the background stop earlier. Move it back afterward. Changing a wrapper’s boundaries is a quick way to understand which content belongs to it.</p>
<p>Try a second paragraph with another pickup class. Both locations should get the same treatment. You do not need a new rule for every occurrence. An id is different: each identifier must be unique within the document, even if the elements happen to look identical.</p>
<p>For a larger site, keep shared rules in an external file instead of copying a style block into every page. Our guide to <a href="https://html5doctor.com/how-to-link-css-to-html/">linking CSS to HTML</a> covers the file connection and relative paths. The markup in the body can stay exactly the same.</p>
<h2 id="choose">Span, div or a semantic element?</h2>
<p>Before adding a span, ask what the content actually is. If it is a heading, link, quotation or instruction of strong importance, HTML already has elements that express those jobs. A wrapper with an impressive class name does not supply the same meaning.</p>
<div>
<table>
<caption>Choose the element by the job</caption>
<thead>
<tr>
<th scope="col">Job</th>
<th scope="col">Usually choose</th>
<th scope="col">Reason</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Style a neutral phrase</th>
<td>span with a class</td>
<td>A small hook without an added meaning</td>
</tr>
<tr>
<th scope="row">Group a generic layout region</th>
<td>div</td>
<td>Can contain paragraphs and other flow content</td>
</tr>
<tr>
<th scope="row">Convey strong importance</th>
<td>strong</td>
<td>Describes importance, not just weight</td>
</tr>
<tr>
<th scope="row">Stress a word</th>
<td>em</td>
<td>Marks emphasis within the sentence</td>
</tr>
<tr>
<th scope="row">Go to another page</th>
<td>a with href</td>
<td>Provides a real hyperlink</td>
</tr>
<tr>
<th scope="row">Run an ordinary action</th>
<td>button</td>
<td>Supplies native button behavior</td>
</tr>
</tbody>
</table>
</div>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;p&gt;&lt;strong&gt;Bring your order number.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Please collect it &lt;em&gt;today&lt;/em&gt;, not tomorrow.&lt;/p&gt;
&lt;p&gt;Track your parcel on the &lt;a href="/orders/"&gt;orders page&lt;/a&gt;.&lt;/p&gt;</code></pre>
<p>These fragments illustrate meaning. Bring your order number is important. Stressing today changes how the instruction is read. The orders link needs an existing /orders/ destination on your site. None of those tasks needs a span masquerading as another element. The difference lies not in how you style it, but in what message you send to your visitors.</p>
<p>A div normally starts a block; a span normally participates in a line of text. CSS can change that display behavior, but it does not change which child elements are allowed. Putting a paragraph inside a span is not repaired by giving the span display: block. Use a suitable container in the first place. Changing display also does not turn a neutral wrapper into a heading or a control.</p>
<figure><img decoding="async" alt="Comparison of a neutral span, strong importance, an emphasized word and a real navigation link." class="wp-image-6441" height="1000" loading="lazy" src="https://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-semantic-element-choices.webp" style="max-width:100%;height:auto" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-semantic-element-choices.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-semantic-element-choices-300x188.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-semantic-element-choices-1024x640.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-semantic-element-choices-768x480.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-semantic-element-choices-1536x960.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>Use a semantic element when it already describes the content’s job.</figcaption></figure>
<h2 id="language">Mark a phrase in another language</h2>
<p>A span can carry useful information even when you apply no styling at all. In an English paragraph, lang=&#8221;es&#8221; identifies a Spanish phrase. Here is the line from the complete example:</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;p&gt;Ask for &lt;span lang="es"&gt;la caja&lt;/span&gt;, meaning the box.&lt;/p&gt;</code></pre>
<p>The attribute applies to the wrapped phrase, not the whole paragraph. It does not translate the words. If the entire paragraph were Spanish, you could put lang on the paragraph itself and skip the extra wrapper.</p>
<p><a href="https://www.tamucc.edu/information-technology/accessibility/wcag/define-language.php">Texas A&amp;M University–Corpus Christi’s language guidance</a> demonstrates using span when only part of a page changes language. Match the language code to the actual text; choosing a code because it produces a preferred voice defeats its purpose.</p>
<p>Language information can help assistive technology choose pronunciation. It is worth checking with the languages and voices available in your testing setup rather than assuming every combination sounds the same. <a href="https://marcom.wwu.edu/accessibility/guide/identify-language-page-or-content">Western Washington University’s language guide</a> describes why identifying both page language and inline changes matters.</p>
<h2 id="layout">Understand inline layout</h2>
<p>Inline does not mean “always on one line.” A long phrase inside a normal span can wrap across lines as the available width shrinks. The span does not insert a forced line break, but it also does not prevent normal text wrapping.</p>
<p>There is another common surprise: setting width or height on an ordinary inline span does not size it like a block. If you need a compact box within a line, such as a delivery-time label, inline-block is one option.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">&lt;span class="delivery-slot"&gt;9–11 am&lt;/span&gt;</code></pre>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #cbd5e1;padding:1rem;line-height:1.6"><code style="background:#ffffff !important;color:#172331 !important">.delivery-slot {
  display: inline-block;
  min-width: 6rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid #64748b;
  border-radius: 0.25rem;
}</code></pre>
<p>The time label now accepts a minimum width and has padding and a border. It remains part of the surrounding inline layout. There is no need to turn every styled word into an inline-block box, though. A phrase that should flow naturally through a sentence is often better left inline.</p>
<p>Large vertical padding on an ordinary inline box can overlap neighboring lines rather than neatly pushing them apart. Check more than the one line where you first added the style. A narrow window makes these problems easier to spot.</p>
<p>For a typeface change, use a class with the appropriate CSS font property. You can apply the class directly to an existing element if the whole element needs it. Our <a href="https://html5doctor.com/how-to-change-font-in-html/">guide to changing fonts in HTML</a> explains family choices and fallbacks. A span is useful only when you need a smaller target.</p>
<figure><img decoding="async" alt="An inline phrase wrapping through text compared with an inline-block delivery-time label with padding and a border." class="wp-image-6442" height="900" loading="lazy" src="https://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-inline-and-inline-block.webp" style="max-width:100%;height:auto" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-inline-and-inline-block.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-inline-and-inline-block-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-inline-and-inline-block-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-inline-and-inline-block-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/what-is-span-in-html-inline-and-inline-block-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>Normal inline text can wrap; inline-block creates a box that accepts sizing.</figcaption></figure>
<h2 id="trouble">Troubleshoot a stubborn span</h2>
<p>If the words remain unchanged, look at the element in the browser inspector. Is the class actually present? Does the selector match it? Check the stylesheet request before adding stronger selectors or important declarations. The problem might simply be a missing file.</p>
<div>
<table>
<caption>Symptoms and the next check</caption>
<thead>
<tr>
<th scope="col">Symptom</th>
<th scope="col">Check</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">No color change</th>
<td>Class spelling, selector dot and stylesheet loading</td>
</tr>
<tr>
<th scope="row">Too many words styled</th>
<td>Position of the closing span tag</td>
</tr>
<tr>
<th scope="row">Width has no effect</th>
<td>Computed display value; normal inline boxes ignore width</td>
</tr>
<tr>
<th scope="row">Unexpected line break</th>
<td>A display override or a different surrounding element</td>
</tr>
<tr>
<th scope="row">Mouse works; keyboard does not</th>
<td>A clickable span used where a native link or button belongs</td>
</tr>
</tbody>
</table>
</div>
<p>Do not attach click behavior to a span just to avoid a button’s default appearance. You would have to recreate keyboard handling, focus and semantics. Style the correct native control instead. A neutral text wrapper should not accidentally become the only way to perform an action.</p>
<p>Keep wrapping restrained, too. If one class can be placed on an existing paragraph, adding three nested spans makes inspection harder without helping the reader. Remove a wrapper when it no longer carries a needed attribute or provides a useful selection boundary.</p>
<h2 id="questions">Questions and self-check</h2>
<h3>Does span add a line break?</h3>
<p>Not by default. It is inline. Text may still wrap naturally, and CSS can change the element’s display.</p>
<h3>Can I nest spans?</h3>
<p>Yes, when their content remains valid. Close them in reverse order and keep a reason for each wrapper. You rarely need a separate span for every word.</p>
<h3>Will a span improve SEO?</h3>
<p>A generic wrapper provides no automatic ranking benefit. Use clear content and meaningful elements. Do not replace headings or links with styled spans and expect search engines or readers to recover the lost structure.</p>
<h3>Check your understanding</h3>
<p>Choose your answer, then open each explanation. The answers use native disclosures and require no custom article script.</p>
<details>
<summary>1. You need an important warning. Span or strong?</summary>
<p>Use strong for strong importance. CSS can control its appearance separately.</p>
</details>
<details>
<summary>2. One phrase changes to Spanish. Where should lang go?</summary>
<p>On the element enclosing that phrase. A span is useful when no existing element marks exactly that boundary.</p>
</details>
<details>
<summary>3. Does display: block let a span contain paragraphs?</summary>
<p>No. CSS display does not change HTML content rules. Choose a suitable container.</p>
</details>
</div>
</div>
<p>The post <a href="http://html5doctor.com/what-is-span-in-html/">What Is Span in HTML? Examples, CSS and Common Mistakes</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Change Image Size in HTML Without Stretching</title>
		<link>http://html5doctor.com/how-to-change-image-size-in-html/</link>
		
		<dc:creator><![CDATA[Steve Faulkner]]></dc:creator>
		<pubDate>Mon, 09 Nov 2026 10:27:23 +0000</pubDate>
				<category><![CDATA[Quick Tips]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6459</guid>

					<description><![CDATA[<p>Here is how to change image size in HTML. Give the image a CSS width, let its height adjust automatically and cap the width at the size of its column. Keep the original proportions in the HTML dimension attributes. The example below takes a 1200 by 800 drawing and gives it a 600-pixel display width. [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/how-to-change-image-size-in-html/">How to Change Image Size in HTML Without Stretching</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="h5d-guide">
<p>Here is how to change image size in HTML. Give the image a CSS width, let its height adjust automatically and cap the width at the size of its column. Keep the original proportions in the HTML dimension attributes. The example below takes a 1200 by 800 drawing and gives it a 600-pixel display width.</p>
<p>There are three versions of the same problem hiding in the word “size.” The picture can take up less space on the page, it can show a smaller part of the scene, or it can take fewer bytes to download. Start with the full bridge and make it fit the page.</p>
<figure><img loading="lazy" decoding="async" alt="How to change image size in HTML with a 1200 by 800 bridge illustration displayed at 600 by 400 and 300 by 200." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-proportional-resize.webp" class="wp-image-6458" style="display:block;max-width:100%;height:auto" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-proportional-resize.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-proportional-resize-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-proportional-resize-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-proportional-resize-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-proportional-resize-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>Halve the width of this 3:2 image and the height halves too. A smaller display box does not shrink the source file.</figcaption></figure>
<nav aria-label="Contents">
<p><strong>Contents</strong></p>
<ol>
<li><a href="#resize">Resize one image</a></li>
<li><a href="#example">Try a complete local example</a></li>
<li><a href="#ratio">Keep the original proportions</a></li>
<li><a href="#fit">Crop or fit a square thumbnail</a></li>
<li><a href="#files">Choose a smaller download</a></li>
<li><a href="#fix">Fix common sizing problems</a></li>
<li><a href="#questions">Questions and self-check</a></li>
</ol>
</nav>
<h2 id="resize">How to change image size in HTML for one image</h2>
<p>Start with the image element. This artwork has a 1200 by 800 source size. Leave those numbers in the markup and put the desired display width in the style. The automatic height and width cap take care of the narrower layouts.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d9e0e7;padding:1rem;max-width:100%"><code style="background:#ffffff !important;color:#172331 !important">&lt;img src="bridge.svg" width="1200" height="800"
     alt="A footbridge over a river between two hills"
     style="width: 600px; max-width: 100%; height: auto;"&gt;</code></pre>
<p>Give this example a 300-pixel column. It has room for only half the requested width, so the drawing comes out at 300 by 200. Open the column wider and the picture grows until it reaches 600 by 400.</p>
<p>You can predict each result from two measurements. Look at the width you asked for and the width the column has available. Use the smaller one to work out the height.</p>
<p>One inline style is fine for an exercise. If you have a row of illustrations, give them a shared class. Next time the design changes, you will have one width to edit. A broad rule on every image would also reach logos and icons that may need different sizes. See the <a href="https://html5doctor.com/how-to-link-css-to-html/">guide to linking CSS to HTML</a>.</p>
<h2 id="example">Try a complete local example</h2>
<ol>
<li>Create a folder for the two files.</li>
<li>Save the page as index.html and the drawing as bridge.svg.</li>
<li>Open the page and narrow the browser window.</li>
</ol>
<p>Make a folder for this example and save both files in it. Name the page index.html and the artwork bridge.svg. Then open the page. If you see broken-image text instead of the river, check the two names and their capitalization before editing the CSS. Resize the window after the drawing appears. The bridge should stay in view and the scene should keep its shape.</p>
<h3>index.html</h3>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d9e0e7;padding:1rem;max-width:100%"><code style="background:#ffffff !important;color:#172331 !important">&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport"
        content="width=device-width, initial-scale=1"&gt;
  &lt;title&gt;Bridge photo sizing&lt;/title&gt;
  &lt;style&gt;
    body { margin: 16px; font-family: system-ui, sans-serif; }
    .bridge {
      display: block;
      width: 600px;
      max-width: 100%;
      height: auto;
    }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;h1&gt;River crossing&lt;/h1&gt;
  &lt;img class="bridge" src="bridge.svg"
       width="1200" height="800"
       alt="A footbridge over a river between two hills"&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<h3>bridge.svg</h3>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d9e0e7;padding:1rem;max-width:100%"><code style="background:#ffffff !important;color:#172331 !important">&lt;svg xmlns="http://www.w3.org/2000/svg"
     width="1200" height="800" viewBox="0 0 1200 800"&gt;
  &lt;rect width="1200" height="800" fill="#dcecf5"/&gt;
  &lt;circle cx="918" cy="151" r="63" fill="#f2b958"/&gt;
  &lt;path d="M0 600V350L270 130L650 560Z" fill="#629589"/&gt;
  &lt;path d="M1200 600V310L910 220L550 560Z" fill="#386e62"/&gt;
  &lt;path d="M0 545Q630 380 1200 545V800H0Z" fill="#2e7297"/&gt;
  &lt;path d="M265 520Q600 380 935 520" fill="none"
        stroke="#623b2b" stroke-width="34"/&gt;
  &lt;path d="M310 509V602M500 455V580M700 455V580M890 509V602"
        stroke="#623b2b" stroke-width="18"/&gt;
&lt;/svg&gt;</code></pre>
<p>There are 16 CSS pixels of margin on each side of the page. A 632-pixel viewport leaves 600 for the drawing. Try 332 pixels instead and you have 300 left. These are useful checkpoints if you are resizing the example in developer tools. Add a sidebar and the calculation changes.</p>
<p>Set the width in the stylesheet to 450px. On a wide screen the drawing should now take up 450 by 300 pixels. Open bridge.svg by itself and it still declares 1200 by 800. The display experiment has left your original artwork intact.</p>
<p>The flexible-image pattern pairs a width limit with automatic height. Give the column room to shrink as well. If a card refuses to get narrower, a rule on the image alone won’t fit the whole card into a phone screen. The <a href="https://it502.cs.unh.edu/tutorials/spring25/jtc1115/responsive-design.html">University of New Hampshire’s mobile web design example</a> shows the two image rules together.</p>
<h2 id="ratio">Keep the original proportions</h2>
<p>The bridge has three units of width for every two of height. If you halve one dimension, halve the other. Need the exact height for an unusual width? Multiply the new width by 800 and divide by 1200. With automatic height, you can leave that calculation to the browser.</p>
<p>The dimension attributes take plain numbers. A raster file’s actual pixel dimensions give you a sensible pair. With this SVG, the declared dimensions and the view box agree. The browser can use those proportions to set aside space while the picture loads.</p>
<p>A template that looks fine with the first landscape photo may fail on the next portrait. If every image gets the same landscape dimensions, the browser can reserve the wrong space for some of them. Watch the text underneath as an image arrives. A jump at that moment is a reason to check the attributes.</p>
<p>CSS can override the size implied by the attributes. Think of the markup as giving the browser early information about the image, while the stylesheet decides the display box. Inspect the image and its parent if their measurements don’t make sense together. <a href="https://openlab.bmcc.cuny.edu/mmp-350-sp24/responsive-images-and-video/">BMCC’s responsive images walkthrough</a> also shows how the image and its container work together.</p>
<div class="table-scroll" role="region" aria-label="Pick the sizing rule by the result you need" tabindex="0">
<table>
<caption>Pick the sizing rule by the result you need</caption>
<thead>
<tr>
<th scope="col">Goal</th>
<th scope="col">Rule to try</th>
<th scope="col">Effect</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Smaller full image</th>
<td>Width with automatic height</td>
<td>Original proportions stay intact</td>
</tr>
<tr>
<th scope="row">Flexible article image</th>
<td>Maximum width of 100% with automatic height</td>
<td>The image can shrink in its column</td>
</tr>
<tr>
<th scope="row">Uniform thumbnail</th>
<td>Fixed ratio box with cover</td>
<td>The frame fills and edges may be cropped</td>
</tr>
<tr>
<th scope="row">Whole diagram in a frame</th>
<td>Fixed ratio box with contain</td>
<td>The full image remains visible with possible gaps</td>
</tr>
<tr>
<th scope="row">Smaller transfer</th>
<td>Optimized files and source candidates</td>
<td>The browser can download a smaller asset</td>
</tr>
</tbody>
</table>
</div>
<h2 id="fit">Crop or fit a square thumbnail</h2>
<p>For a set of matching cards, decide the frame size first. The sample below makes the frame square, up to 240 pixels wide, and sizes the image element to that frame. The fitting rule controls the drawing inside it.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d9e0e7;padding:1rem;max-width:100%"><code style="background:#ffffff !important;color:#172331 !important">&lt;div class="tile"&gt;
  &lt;img src="bridge.svg" width="1200" height="800"
       alt="A footbridge over a river between two hills"&gt;
&lt;/div&gt;</code></pre>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d9e0e7;padding:1rem;max-width:100%"><code style="background:#ffffff !important;color:#172331 !important">.tile {
  width: min(100%, 240px);
  aspect-ratio: 1 / 1;
  background: #e6ecee;
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}</code></pre>
<p>Look at the square when it reaches 240px. Cover makes the drawing 360px by 240px and crops 60px from both ends when it’s centred. Contain makes it 240px by 160px, with room for 40px bands above and below. The same frame stays in place while you swap the fitting rule.</p>
<figure><img loading="lazy" decoding="async" alt="Two square frames show the bridge cropped at the sides with cover and fully visible with blank bands under contain." height="1000" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-cover-contain-comparison.webp" class="wp-image-6456" style="display:block;max-width:100%;height:auto" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-cover-contain-comparison.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-cover-contain-comparison-300x188.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-cover-contain-comparison-1024x640.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-cover-contain-comparison-768x480.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-cover-contain-comparison-1536x960.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>Cover fills the square by cropping the sides. Contain keeps the entire scene and leaves room above and below.</figcaption></figure>
<p>Put a detail near the left edge of the source and try left center. The crop favors that edge. Now use a portrait source and notice that the extra area to crop lies on a different axis. Preview the images you intend to ship. Look for signs or faces that sit close to an edge.</p>
<p>When one crop will be used over and over, export it as a separate file. A CSS crop can hide the sides of the wide illustration, but those sides are still part of the download. Keep the full artwork for placements where the missing details matter. <a href="https://web.tamu.edu/best-practices/how-to-optimize-images-for-the-web/">Texas A&amp;M’s image optimization guidance</a> covers cropping before upload.</p>
<h2 id="files">Choose a smaller download</h2>
<p>A card can display a tiny version of a huge photograph. Open the Network panel and the original file may still be the one arriving. To cut that transfer, export a more appropriate file or offer several widths. Compare the bytes and the visible result.</p>
<p>The three sample WebPs came from the same drawing with the same quality setting. The 300px, 600px and 1200px exports are 2,168, 4,414 and 9,004 bytes. Use the filenames shown below after exporting. The numbers are small because this is a flat drawing, and your own photos will give you another set of file sizes.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d9e0e7;padding:1rem;max-width:100%"><code style="background:#ffffff !important;color:#172331 !important">&lt;img class="bridge" src="bridge-600.webp"
     srcset="bridge-300.webp 300w,
             bridge-600.webp 600w,
             bridge-1200.webp 1200w"
     sizes="(max-width: 632px) calc(100vw - 32px), 600px"
     width="1200" height="800"
     alt="A footbridge over a river between two hills"&gt;</code></pre>
<p>Read a source candidate from right to left. The 600w suffix tells the browser that the file itself is 600 pixels wide. Read sizes separately. It says the display slot is the viewport width minus 32 pixels up to the breakpoint, then 600 CSS pixels. The stylesheet continues to set the display width.</p>
<p>At a 300 CSS pixel slot, 300 source pixels can cover one source pixel per CSS pixel. A 600-pixel source offers more detail for a denser screen. The browser makes the actual choice. In developer tools, check which request was made. A cached candidate or a different device density can affect what you observe.</p>
<figure><img loading="lazy" decoding="async" alt="A 300 CSS pixel display slot illustrated beside 300 and 600 pixel wide source candidates for different screen densities." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-responsive-source-choice.webp" class="wp-image-6457" style="display:block;max-width:100%;height:auto" width="1600" srcset="http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-responsive-source-choice.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-responsive-source-choice-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-responsive-source-choice-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-responsive-source-choice-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-change-image-size-in-html-responsive-source-choice-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>The layout can stay 300 CSS pixels wide while the browser chooses between files with different pixel widths.</figcaption></figure>
<h2 id="fix">Fix common image sizing problems</h2>
<p>Find the actual width and height in the inspector. If the picture looks squashed, compare that pair with the source ratio. A second rule fixing the height is an obvious suspect. If the page itself overflows, check the card and the column before blaming the picture.</p>
<div class="table-scroll" role="region" aria-label="Symptoms and the first place to look" tabindex="0">
<table>
<caption>Symptoms and the first place to look</caption>
<thead>
<tr>
<th scope="col">Symptom</th>
<th scope="col">First check</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Stretched image</th>
<td>Find the competing height or restore automatic height</td>
</tr>
<tr>
<th scope="row">Image spills out of its column</th>
<td>Check both the width cap and the parent’s minimum size</td>
</tr>
<tr>
<th scope="row">Important edges disappear</th>
<td>Review cover, position and frame proportions</td>
</tr>
<tr>
<th scope="row">Image still downloads slowly</th>
<td>Inspect the requested file, its bytes and source candidates</td>
</tr>
<tr>
<th scope="row">Correct size, wrong alignment</th>
<td>Inspect margins and the parent layout</td>
</tr>
</tbody>
</table>
</div>
<p>If the bridge fits the column but sits against one edge, look at the margins. Two automatic inline margins can center a block image that has spare room. The <a href="https://html5doctor.com/how-to-center-an-image-in-html/">image-centering guide</a> shows how to apply that to a picture in a column or a card.</p>
<h2 id="questions">Questions and self-check</h2>
<h3>Can I set only the width?</h3>
<p>Yes. A CSS width and automatic height usually give proportional resizing. Include the source dimensions in the markup when you know them so space can be reserved early.</p>
<h3>Will a small image become sharper if I enlarge it?</h3>
<p>Enlarging a raster file can expose blur or pixelation. Use a sufficiently detailed source for that placement and compare it at the real display size.</p>
<h3>Does object-fit change the image file?</h3>
<p>It changes how image content is drawn inside the element’s box. To change the downloaded crop or bytes, export a different file and reference it.</p>
<h3>Check your choices</h3>
<details>
<summary>1. A 1200 by 800 image is shown 450 pixels wide. What is its proportional height?</summary>
<p>300 CSS pixels. Multiply 450 by 800 and divide by 1200.</p>
</details>
<details>
<summary>2. Every label in a diagram must remain visible inside a square. Which fit should you try?</summary>
<p>Try contain. It preserves the whole diagram and can leave unused space around it.</p>
</details>
<details>
<summary>3. The image looks smaller but its download is the same size. What needs to change?</summary>
<p>Change the file served or supply appropriately sized source candidates. Display width alone does not alter transfer bytes.</p>
</details>
</div>
<p>The post <a href="http://html5doctor.com/how-to-change-image-size-in-html/">How to Change Image Size in HTML Without Stretching</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Open HTML File on iPhone: Files, Viewers and Safari</title>
		<link>http://html5doctor.com/how-to-open-html-file-on-iphone/</link>
		
		<dc:creator><![CDATA[Steve Faulkner]]></dc:creator>
		<pubDate>Sun, 08 Nov 2026 12:05:20 +0000</pubDate>
				<category><![CDATA[Quick Tips]]></category>
		<guid isPermaLink="false">https://html5doctor.com/?p=6455</guid>

					<description><![CDATA[<p>The name at the bottom of the email is report.html. You can see a few lines of markup when you tap it, though the email promised a report. For anyone trying to figure out how to open an HTML file on iPhone, the quickest check is to save the attachment to Files and open that [&#8230;]</p>
<p>The post <a href="http://html5doctor.com/how-to-open-html-file-on-iphone/">How to Open HTML File on iPhone: Files, Viewers and Safari</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="h5d-guide">
<p>The name at the bottom of the email is <code style="background:#ffffff !important;color:#172331 !important">report.html</code>. You can see a few lines of markup when you tap it, though the email promised a report. For anyone trying to figure out how to open an HTML file on iPhone, the quickest check is to save the attachment to Files and open that copy. If you still see code, press and hold the file and look for a compatible viewer under Open With.</p>
<p>Start with one detail. Were you given a file you can save, or an address you can paste? Open the address in Safari. The file goes through Files first. That distinction saves a lot of time looking for Safari in the wrong menu.</p>
<figure><img loading="lazy" decoding="async" alt="How to open HTML file on iPhone illustrated with a local file route through Files and a web address route through Safari." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/how-to-open-html-file-on-iphone-file-or-url.webp" class="wp-image-6454" width="1600" style="display:block;max-width:100%;height:auto" srcset="http://html5doctor.com/wp-content/uploads/2026/11/how-to-open-html-file-on-iphone-file-or-url.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-open-html-file-on-iphone-file-or-url-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-open-html-file-on-iphone-file-or-url-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-open-html-file-on-iphone-file-or-url-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/how-to-open-html-file-on-iphone-file-or-url-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>A saved HTML document and a website address need different opening routes.</figcaption></figure>
<nav aria-label="Contents">
<p><strong>Contents</strong></p>
<ol>
<li><a href="#find">Find or save the HTML file</a></li>
<li><a href="#open">Open it with a compatible app</a></li>
<li><a href="#safari">When to use Safari</a></li>
<li><a href="#project">Keep project files together</a></li>
<li><a href="#example">Try a small complete example</a></li>
<li><a href="#fix">Fix common opening problems</a></li>
<li><a href="#faq">Frequently asked questions</a></li>
<li><a href="#quiz">Quick self-check</a></li>
</ol>
</nav>
<h2 id="find">How to open HTML file on iPhone: find the document first</h2>
<p>Start in the place you received it. Still looking at an attachment inside Mail or another email app? Look for Save to Files in the available actions. Choose a folder and remember it. If the document was already downloaded, go straight to Files. Its name might be monthly-report.html, not index.html; search for the name the sender used.</p>
<ol>
<li>Open Files. If you cannot find the app, search for Files from the Home Screen.</li>
<li>Tap Browse and look in the location where you saved the document.</li>
<li>Check Downloads, including Downloads inside iCloud Drive if that is your download location.</li>
<li>Use the Files search field for the filename or its HTML extension if necessary.</li>
<li>Tap the file once it has finished downloading.</li>
</ol>
<p>Wait for the download to finish. An item in iCloud Drive can be listed even when its contents are not yet on the phone. A pending cloud-download indicator is a clue to check the connection. Offline access is a separate check: open the downloaded document without a connection if that is how you plan to use it.</p>
<p>A broken email preview does not prove the HTML is broken. The <a href="https://teamdynamix.umich.edu/TDClient/30/Portal/KB/PrintArticle?ID=12888">University of Michigan’s HTML-attachment support note</a> documents a case where downloading was necessary because an email preview displayed incorrectly. Its illustrated steps are for desktop email, but the distinction between an attachment preview and the saved file is useful here too.</p>
<h2 id="open">Choose an app that can do the job</h2>
<p>Touch and hold the file. Where available, Open With lets you choose from compatible installed apps. On current iPhone software, Get Info also offers Always Open With for a default choice. You may see different options on older software or with a different file type. Use the choices actually shown on your phone.</p>
<p>Check what each app means by “open.” Some will let you type between the tags. Others offer a rendered preview. An app that works fine with a single page can still fall short with a folder full of style and script files. Look for local HTML preview and folder import in the app’s help if you need both.</p>
<p>No suitable app listed? You may be limited to a document preview until you install something that accepts HTML. Read the app’s current documentation: local documents, JavaScript and folder import are distinct features. A plain preview may be enough for a note. A chart-driven dashboard asks much more of its viewer.</p>
<div aria-label="Match the route to your goal" role="region" tabindex="0" class="table-scroll">
<table>
<caption>Match the route to your goal</caption>
<thead>
<tr>
<th scope="col">What you have</th>
<th scope="col">What you want</th>
<th scope="col">Start here</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Downloaded HTML file</th>
<td>View the document</td>
<td>Files, then a compatible viewer or preview</td>
</tr>
<tr>
<th scope="row">HTML source</th>
<td>Edit the tags</td>
<td>A text or code editor</td>
</tr>
<tr>
<th scope="row">A website address</th>
<td>Use the live page</td>
<td>Safari’s address field</td>
</tr>
<tr>
<th scope="row">A complete project folder</th>
<td>Use linked files and scripts</td>
<td>A suitable folder-aware viewer or web hosting</td>
</tr>
</tbody>
</table>
</div>
<h2 id="safari">Use Safari for a hosted webpage address</h2>
<p>Use Safari’s address field when the sender gives you the full web address. If the page requires a sign-in, use the account that has access to the site. A saved file in Downloads might have the same name as the page, but the name alone won’t tell Safari where the site lives.</p>
<p>A search for this problem often turns up “Share, then Open in Safari.” Check what’s actually on your Share sheet. The option can depend on the app and the kind of item you’re sharing. The same goes for a Shortcut. Launching the browser and giving it an address it can load are separate steps.</p>
<p>If you created a small public project, hosting it gives you a normal URL to open in Safari. <a href="https://docs.netlify.com/deploy/create-deploys/">Netlify’s deployment documentation</a>, for example, describes publishing a folder containing site files and receiving a URL. Its drag-and-drop workflow is easiest from a computer. This is an optional publishing route, not a required step for reading a private attachment.</p>
<p>An address for a public demo is easy to pass around. For a payroll report or another restricted document, ask for an approved private link or a PDF. If you didn’t expect an HTML attachment, check the sender before trying a viewer that can run its scripts.</p>
<h2 id="project">Keep CSS, images and scripts with the HTML</h2>
<p>Where did the picture go? Look at what was sent. If the attachment contains only index.html, there may never have been a picture on the phone to lose. The HTML can name a separate image, stylesheet or script without containing it. Request the project folder or a self-contained export; renaming the HTML will not retrieve absent resources.</p>
<figure><img loading="lazy" decoding="async" alt="HTML project diagram keeps index.html beside styles.css and an images folder containing leaf.png." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/iphone-html-project-files-and-relative-paths.webp" class="wp-image-6453" width="1600" style="display:block;max-width:100%;height:auto" srcset="http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-project-files-and-relative-paths.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-project-files-and-relative-paths-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-project-files-and-relative-paths-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-project-files-and-relative-paths-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-project-files-and-relative-paths-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>Moving index.html alone can leave its stylesheet and images behind.</figcaption></figure>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d9e0e7;padding:1rem;max-width:100%"><code style="background:#ffffff !important;color:#172331 !important">project/
  index.html
  styles.css
  images/
    leaf.png</code></pre>
<p>In this layout, index.html can reference styles.css and images/leaf.png. Moving the HTML into a different folder without those companions breaks the expected paths. The <a href="https://sts.doit.wisc.edu/manuals/html/">University of Wisconsin’s HTML manual</a> explains site folders and relative references. That principle applies whether you are inspecting a project on a computer or importing it into a phone viewer.</p>
<p>If the photo comes through and the colours are missing, follow the path to <code style="background:#ffffff !important;color:#172331 !important">styles.css</code>. The <a href="https://html5doctor.com/how-to-link-css-to-html/">stylesheet walkthrough</a> shows what to compare. Even with the right path, a viewer that has only been given access to the HTML may be unable to read the file next to it. Give it the whole folder if the app supports that.</p>
<p>For a ZIP, save the archive in Files and tap it to extract a folder. Look inside that folder for the HTML. Keep the subfolders when importing the project into a suitable app. Extracting the archive gives you its contents; it does not supply a web server or make server-side code execute.</p>
<h2 id="example">Try a small complete HTML example</h2>
<p>Make one tiny file before troubleshooting a large report. Save the example as <code style="background:#ffffff !important;color:#172331 !important">hello.html</code> in a plain-text editor. Transfer it to Files and try opening it. It needs no image, separate stylesheet or network request. That gives you something you can try in two different viewers and compare.</p>
<pre style="background:#ffffff !important;color:#172331 !important;border:1px solid #d9e0e7;padding:1rem;max-width:100%"><code style="background:#ffffff !important;color:#172331 !important">&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;title&gt;Local HTML check&lt;/title&gt;
  &lt;style&gt;
    body {
      font-family: system-ui, sans-serif;
      margin: 1rem;
      color: #172331;
      background: #ffffff;
      line-height: 1.6;
    }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;h1&gt;Hello from HTML&lt;/h1&gt;
  &lt;p&gt;This page needs no external files.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<figure><img loading="lazy" decoding="async" alt="Comparison shows HTML source for a heading beside the rendered words Hello from HTML." height="900" src="https://html5doctor.com/wp-content/uploads/2026/11/iphone-html-source-preview-and-browser-page.webp" class="wp-image-6452" width="1600" style="display:block;max-width:100%;height:auto" srcset="http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-source-preview-and-browser-page.webp 1600w, http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-source-preview-and-browser-page-300x169.webp 300w, http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-source-preview-and-browser-page-1024x576.webp 1024w, http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-source-preview-and-browser-page-768x432.webp 768w, http://html5doctor.com/wp-content/uploads/2026/11/iphone-html-source-preview-and-browser-page-1536x864.webp 1536w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /><figcaption>Seeing angle brackets means you are looking at source; a rendered view interprets the markup.</figcaption></figure>
<p>You’re looking for “Hello from HTML” and a sentence underneath. The heading is the easy clue. If you see the tags around it, try the app’s render or preview option. There’s another small test page in the <a href="https://html5doctor.com/what-is-html/">guide to what HTML does</a>.</p>
<p>Now compare the small file with the troublesome one. Does only the larger page fail? List its dependencies: JavaScript, an API, a login, perhaps a server. PHP needs a suitable server; downloading the HTML does not provide one. A blank chart can be an environment problem even when every byte of the download arrived intact.</p>
<h2 id="fix">Troubleshoot without losing the original</h2>
<div aria-label="What to check next" role="region" tabindex="0" class="table-scroll">
<table>
<caption>What to check next</caption>
<thead>
<tr>
<th scope="col">Symptom</th>
<th scope="col">Next check</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Cannot find the file</th>
<td>Search Files; confirm the saved location and download completion.</td>
</tr>
<tr>
<th scope="row">Code appears</th>
<td>Choose rendering rather than source editing.</td>
</tr>
<tr>
<th scope="row">Styles or images are missing</th>
<td>Obtain the linked files and preserve folder paths.</td>
</tr>
<tr>
<th scope="row">No suitable opening app</th>
<td>Check installed apps for HTML document support.</td>
</tr>
<tr>
<th scope="row">Buttons or charts do nothing</th>
<td>Check script support and server/network requirements.</td>
</tr>
</tbody>
</table>
</div>
<p>Keep the original before experimenting with filenames. A genuine HTML text file accidentally named hello.html.txt is one thing; a PDF renamed hello.html is another. Correcting the first may help an app recognise it. The second is still a PDF. Extensions label files; changing the label does not convert the contents.</p>
<p>When you write to the sender, describe one thing they can check. “I can read the first page in Files, but the drop-down never changes the chart” is specific enough to tell them where to look. Include the app you opened it in.</p>
<h3>A quick check before sending HTML to an iPhone</h3>
<p>Open a copy of the actual attachment from a folder with nothing else in it. That can reveal a dependency on a stylesheet from your working directory. If the copy needs more than one file, send a ZIP with the paths in place.</p>
<p>Tell the reader what a successful open looks like. “You’ll see a table and our logo” gives a clear result. “Choose a month and watch the chart update” also tells them to look for a working interaction.</p>
<p>If a page keeps breaking, put one dependency back at a time. Start with the standalone file, add the stylesheet and then the photograph. Test the script last. Write down which change brought back the fault.</p>
<h2 id="faq">Frequently asked questions</h2>
<h3>Can I open a local HTML file directly in Safari?</h3>
<p>Do not rely on a universal Files-to-Safari command. Choose an app that accepts the local document, or use Safari to visit the URL of a properly hosted page.</p>
<h3>Can I read it offline?</h3>
<p>A self-contained static page may work offline in a suitable viewer once downloaded. A remote image or font still needs to be fetched, and an online service still needs its connection. One saved HTML document is not a guarantee of offline operation.</p>
<h3>Is a PDF the same as an HTML file?</h3>
<p>No. A PDF can be useful if you only need to read a fixed report, so ask the sender about an export. You may lose interactive features. Changing the filename is not the same as converting the contents.</p>
<h2 id="quiz">Quick self-check</h2>
<p>Pick your answer, then reveal the explanation. These native controls need no custom script.</p>
<details>
<summary>Does seeing source code mean the HTML is corrupt?</summary>
<p>No. You may be using an editor or text view rather than a renderer.</p>
</details>
<details>
<summary>Will index.html automatically include a separate images folder?</summary>
<p>No. Transfer the resources too, preserve their paths and use an app that can access them.</p>
</details>
<details>
<summary>Is a downloaded file the same as an https webpage address?</summary>
<p>No. A document-opening app handles the file; Safari can visit the hosted URL.</p>
</details>
</div>
<p>The post <a href="http://html5doctor.com/how-to-open-html-file-on-iphone/">How to Open HTML File on iPhone: Files, Viewers and Safari</a> appeared first on <a href="http://html5doctor.com">HTML5 Doctor</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
