<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://docs.phcode.dev/blog</id>
    <title>Phoenix Code Docs Blog</title>
    <updated>2026-11-21T00:00:00.000Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <link rel="alternate" href="https://docs.phcode.dev/blog"/>
    <subtitle>Phoenix Code Docs Blog</subtitle>
    <icon>https://docs.phcode.dev/img/favicon.ico</icon>
    <entry>
        <title type="html"><![CDATA[How to Turn a PDF Page Into a Clickable Preview in HTML]]></title>
        <id>https://docs.phcode.dev/blog/clickable-pdf-preview-html</id>
        <link href="https://docs.phcode.dev/blog/clickable-pdf-preview-html"/>
        <updated>2026-11-21T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Save one PDF page as a JPG and link the preview to the full document in HTML. Try it with a downloadable two-page café menu and a working website example.]]></summary>
        <content type="html"><![CDATA[<p>Show the first page of a PDF as a small picture on your website. When a visitor clicks the picture or the words below it, they get the complete document.</p>
<p>Try the café menu on your phone or computer. The preview shows <strong>Breakfast &amp; lunch</strong>. Tap it to find <strong>Drinks &amp; sweets</strong> on page two. <a href="https://docs.phcode.dev/tutorials/pdf-menu-preview/cafe-menu.html">Open the finished café page</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="start-with-the-practice-files">Start with the practice files<a href="https://docs.phcode.dev/blog/clickable-pdf-preview-html#start-with-the-practice-files" class="hash-link" aria-label="Direct link to Start with the practice files" title="Direct link to Start with the practice files" translate="no">​</a></h2>
<p>You'll need a browser and a text editor. <a href="https://docs.phcode.dev/tutorials/pdf-menu-preview.zip" download="">Download the café menu project</a> and extract the ZIP. Open the folder that contains <code>cafe-menu.html</code>, <code>menu.pdf</code> and <code>menu-preview.jpg</code>. To make the preview yourself, copy just <code>cafe-menu.html</code> and <code>menu.pdf</code> into a new folder. You'll add the JPG there next.</p>
<p>For your own website, use the HTML page you want visitors to see and put your PDF beside it. You can also <a href="https://docs.phcode.dev/tutorials/pdf-menu-preview/menu.pdf" download="menu.pdf">download the two-page practice PDF</a> on its own.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="how-to-save-pdf-as-jpg-in-your-browser">How to save PDF as JPG in your browser<a href="https://docs.phcode.dev/blog/clickable-pdf-preview-html#how-to-save-pdf-as-jpg-in-your-browser" class="hash-link" aria-label="Direct link to How to save PDF as JPG in your browser" title="Direct link to How to save PDF as JPG in your browser" translate="no">​</a></h2>
<ol>
<li class="">Open the <a href="https://phcode.dev/tools/pdf-to-jpg.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Code PDF to JPG Converter</a>. Select <strong>Choose PDF</strong> and open <code>menu.pdf</code>. Two page previews appear.</li>
<li class="">Under <strong>Resolution</strong>, choose <strong>Custom</strong>. Set <strong>Size by</strong> to <strong>Pixels</strong>, enter <code>600</code> in <strong>Width (px)</strong> and leave <strong>Height (px)</strong> empty. The converter keeps the proportions of your page.</li>
<li class="">Under <strong>Pages to export</strong>, enter <code>1</code>. Check that the tool says <strong>1 of 2 pages selected</strong>. Only the breakfast page should be checked.</li>
<li class="">Select <strong>Convert selected pages</strong>. When page one says <strong>Ready to download</strong>, select its <strong>Download JPG</strong> button. The practice file downloads as <code>menu-page-1.jpg</code>, at 600 × 800 pixels.</li>
<li class="">Rename the download to <code>menu-preview.jpg</code> and move it beside <code>cafe-menu.html</code> and <code>menu.pdf</code>. Open the JPG to check that it shows the café name and the breakfast menu.</li>
</ol>
<a href="https://docs.phcode.dev/tutorials/media/pdf-menu-page-selection.png"><img src="https://docs.phcode.dev/tutorials/media/pdf-menu-page-selection.png" width="356" height="356" style="height:auto" loading="lazy" alt="Page 1 is checked and ready to download as a 600 × 800 JPG. Page 2 is present and unchecked."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="link-the-image-and-its-caption-to-the-pdf">Link the image and its caption to the PDF<a href="https://docs.phcode.dev/blog/clickable-pdf-preview-html#link-the-image-and-its-caption-to-the-pdf" class="hash-link" aria-label="Direct link to Link the image and its caption to the PDF" title="Direct link to Link the image and its caption to the PDF" translate="no">​</a></h2>
<p>Open <code>cafe-menu.html</code> in your text editor. In the practice file, find this link just below <code>&lt;/header&gt;</code>. On your own page, insert it inside <code>&lt;body&gt;</code> where the preview should appear.</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">a</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">class</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">menu-link</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">menu.pdf</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">img</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">src</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">menu-preview.jpg</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">alt</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">width</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">600</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">height</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">800</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">span</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Read the full menu (PDF)</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">span</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">a</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p><code>src</code> names the picture the browser shows. <code>href</code> names the file the link opens. If your document is called <code>lunch-menu.pdf</code>, use <code>href="lunch-menu.pdf"</code> and keep <code>src</code> pointed at your JPG. Change the caption to tell visitors which document opens.</p>
<p>Because the picture and the visible caption are inside the same link, a keyboard user reaches them in one tab stop. The caption already names the destination, so the image has an empty <code>alt=""</code>. <a href="https://www.w3.org/WAI/tutorials/images/functional/#logo-image-within-link-text" target="_blank" rel="noopener noreferrer" class="">W3C guidance on images within links</a>.</p>
<p>The practice page already has the following layout rules. On your own page, add them to your stylesheet or inside a <code>&lt;style&gt;</code> element in <code>&lt;head&gt;</code>. If you use a different JPG, update the HTML width and height to match its pixel dimensions.</p>
<div class="language-css codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-css codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token selector class" style="color:#00009f">.menu-link</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">display</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> inline-flex</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">flex-direction</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> column</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">gap</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.75</span><span class="token unit">rem</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> fit-content</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">max-width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token unit">%</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token selector class" style="color:#00009f">.menu-link</span><span class="token selector" style="color:#00009f"> img</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">display</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> block</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">18</span><span class="token unit">rem</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">max-width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token unit">%</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">height</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> auto</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="check-the-full-menu">Check the full menu<a href="https://docs.phcode.dev/blog/clickable-pdf-preview-html#check-the-full-menu" class="hash-link" aria-label="Direct link to Check the full menu" title="Direct link to Check the full menu" translate="no">​</a></h2>
<p>Save <code>cafe-menu.html</code> and open it in your browser. Click the picture. Depending on your browser settings, the PDF opens in a viewer or downloads. Open the file and check that page two contains <strong>Drinks &amp; sweets</strong> and <strong>Lemon cake</strong>. Go back to the HTML page and try the caption. With a keyboard, press <strong>Tab</strong> until the menu link has a focus outline, then press <strong>Enter</strong>.</p>
<p>If the caption works but the picture is missing, compare <code>src</code> with the JPG's filename and folder. If the picture appears but the PDF fails to open, check <code>href</code> against the PDF's name. When you put the page online, include all three files and test the live link from your phone. For a link to another HTML page, see <a class="" href="https://docs.phcode.dev/docs/tutorials/link-pages">Link to another page in Phoenix Code</a>.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="HTML" term="HTML"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Convert a Word document to Markdown and check the headings and table]]></title>
        <id>https://docs.phcode.dev/blog/convert-word-to-markdown</id>
        <link href="https://docs.phcode.dev/blog/convert-word-to-markdown"/>
        <updated>2026-11-21T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Convert a Word .docx to GitHub Flavored Markdown with Pandoc. Preview the saved file and check its heading levels, table values, and a pipe inside a cell.]]></summary>
        <content type="html"><![CDATA[<p>Pandoc can turn a Word document into a Markdown file you can use in a GitHub README. One command creates the file. Opening it in a preview lets you check that your headings and table cells survived.</p>
<p>Try it with a walk plan. One meeting point is <strong>Gate A | East car park</strong>. Markdown uses that same vertical bar to separate table cells, so that address gives you an easy way to check your result.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="convert-the-word-file-with-pandoc">Convert the Word file with Pandoc<a href="https://docs.phcode.dev/blog/convert-word-to-markdown#convert-the-word-file-with-pandoc" class="hash-link" aria-label="Direct link to Convert the Word file with Pandoc" title="Direct link to Convert the Word file with Pandoc" translate="no">​</a></h2>
<ol>
<li class=""><a href="https://docs.phcode.dev/tutorials/word-to-markdown/weekend-walk-plan.docx" download="weekend-walk-plan.docx">Download the practice Word document</a>, or use a <code>.docx</code> of your own. Open it and note the headings and the two rows of walk details.</li>
<li class="">Install Pandoc for your operating system. Open a new Terminal or PowerShell window and run <code>pandoc --version</code>. You should see a version number. <a href="https://pandoc.org/installing.html" target="_blank" rel="noopener noreferrer" class="">Pandoc installation instructions</a>.</li>
<li class="">Change to the folder where you saved the Word file. For example, if you saved it in <strong>Downloads</strong> and your terminal starts in your home folder, run <code>cd Downloads</code>. For a different location, type <code>cd</code>, a space, and the full folder path in double quotes.</li>
<li class="">Run the command below. It writes <code>weekend-walk-plan.md</code> beside the Word file. The <code>gfm</code> setting selects GitHub Flavored Markdown, which supports tables. For your own file, change both filenames and choose a new output name if you already have a Markdown copy you want to keep.</li>
</ol>
<div class="language-sh codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-sh codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">pandoc "weekend-walk-plan.docx" -f docx -t gfm -o "weekend-walk-plan.md"</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="open-the-saved-markdown-and-check-the-table">Open the saved Markdown and check the table<a href="https://docs.phcode.dev/blog/convert-word-to-markdown#open-the-saved-markdown-and-check-the-table" class="hash-link" aria-label="Direct link to Open the saved Markdown and check the table" title="Direct link to Open the saved Markdown and check the table" translate="no">​</a></h2>
<p>Open the <a href="https://phcode.dev/tools/markdown-viewer.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Code Markdown Viewer</a>. Choose <strong>Open file</strong> and select <code>weekend-walk-plan.md</code> from the same folder. On a narrow screen, tap <strong>Preview</strong> to see the formatted document.</p>
<ul>
<li class=""><strong>Headings.</strong> The source begins with <code># Saturday walks</code>. The two hashes in <code>## Meeting points</code> put it one level below <strong>Saturday walks</strong>.</li>
<li class=""><strong>Meeting time.</strong> The source reads <code>**9 am**</code>. The preview shows <strong>9 am</strong> in bold.</li>
<li class=""><strong>Table.</strong> Look for three columns. The 4 km Woodland loop meets at <strong>Gate A | East car park</strong>, all in one cell. The 12 km River path meets at <strong>Footbridge</strong>. In the source, <code>\|</code> keeps the bar inside the address.</li>
</ul>
<a href="https://docs.phcode.dev/tutorials/word-to-markdown/converted-walk-plan.png"><img src="https://docs.phcode.dev/tutorials/word-to-markdown/converted-walk-plan.png" width="1290" height="517" style="height:auto" loading="lazy" alt="The Markdown source and its preview show separate headings, two walking routes, and the full Gate A | East car park address in one cell."></a>
<p>If the end of an address disappears from a cell, open the <code>.md</code> in a text editor, put a backslash before the bar inside the address, and save. Open the saved file again in the viewer. You can compare it with <a href="https://docs.phcode.dev/tutorials/word-to-markdown/weekend-walk-plan.md" download="weekend-walk-plan.md">the Markdown file produced from the example</a>. For more on alignment and separators, see <a class="" href="https://docs.phcode.dev/blog/make-a-markdown-table">Make a Markdown table with aligned columns</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="restore-the-word-title-if-your-readme-needs-it">Restore the Word title if your README needs it<a href="https://docs.phcode.dev/blog/convert-word-to-markdown#restore-the-word-title-if-your-readme-needs-it" class="hash-link" aria-label="Direct link to Restore the Word title if your README needs it" title="Direct link to Restore the Word title if your README needs it" translate="no">​</a></h2>
<p>In the Word document, <strong>Weekend walk plan</strong> uses the built-in <strong>Title</strong> style. Pandoc reads it as document metadata, so the command above leaves it out of the Markdown body.</p>
<p>To include the title, open the saved <code>.md</code> in a text editor. Insert <code># Weekend walk plan</code> at the top, followed by a blank line. Change <code># Saturday walks</code> to <code>## Saturday walks</code> and <code>## Meeting points</code> to <code>### Meeting points</code>. Save and reopen the file in the viewer. The title should now sit above both sections, with the route details still in their original cells.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="Markdown" term="Markdown"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Add a Favicon in HTML]]></title>
        <id>https://docs.phcode.dev/blog/how-to-add-a-favicon-in-html</id>
        <link href="https://docs.phcode.dev/blog/how-to-add-a-favicon-in-html"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Add a favicon to your HTML pages, choose the right icon path for a site in a subfolder, and check it from a browser tab.]]></summary>
        <content type="html"><![CDATA[<p>A favicon is the small picture beside a page title in a browser tab. To add one, put the icon file on your website and add a <code>&lt;link rel="icon"&gt;</code> inside each page’s <code>&lt;head&gt;</code>. The <code>href</code> tells the browser where to find the file.</p>
<p>You’ll need an HTML page you can edit and a logo, or you can use the sample image below. We’ll give a site called Trail Notes the same icon on its home page and its About page, one folder deeper.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="make-the-icon-files">Make the icon files<a href="https://docs.phcode.dev/blog/how-to-add-a-favicon-in-html#make-the-icon-files" class="hash-link" aria-label="Direct link to Make the icon files" title="Direct link to Make the icon files" translate="no">​</a></h2>
<ol>
<li class="">Open the free <a href="https://phcode.dev/tools/favicon-generator.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Code Favicon Generator</a>. Click <strong>Choose image</strong> to open a PNG, JPG, or WebP file. To follow along without artwork, click <strong>Try a sample</strong>.</li>
<li class="">Look at <strong>Light tab</strong> and <strong>Dark tab</strong>. Both show the icon at 16 × 16 pixels. If the lettering disappears at this size, try a single letter or a simpler shape.</li>
<li class="">Click <strong>Download icons</strong> and extract <code>favicon.zip</code>. Copy <code>favicon.ico</code>, <code>favicon-96x96.png</code>, and <code>apple-touch-icon.png</code> into the folder that holds your home page. The ZIP also includes a <code>README.txt</code> you can keep for reference.</li>
</ol>
<a href="https://docs.phcode.dev/tutorials/media/favicon-generator-tab-previews.png"><img src="https://docs.phcode.dev/tutorials/media/favicon-generator-tab-previews.png" width="574" height="512" style="height:auto" loading="lazy" alt="Favicon Generator shows the sample letter F beside the page title on light and dark tabs, above the Download icons button."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="link-the-files-from-each-html-page">Link the files from each HTML page<a href="https://docs.phcode.dev/blog/how-to-add-a-favicon-in-html#link-the-files-from-each-html-page" class="hash-link" aria-label="Direct link to Link the files from each HTML page" title="Direct link to Link the files from each HTML page" translate="no">​</a></h2>
<p>In the generator, scroll to <strong>Add it to your website</strong> and click <strong>Copy HTML</strong>. The links start with <code>/</code>, which means the top of your domain. Check the address where your icon will be published before pasting them.</p>
<table><thead><tr><th>Where the icon file opens</th><th>What to use</th></tr></thead><tbody><tr><td><code>https://example.com/favicon.ico</code></td><td>Use the generator’s HTML as copied.</td></tr><tr><td><code>https://example.com/trail-notes/favicon.ico</code></td><td>Add <code>/trail-notes/</code> before each filename as shown below. Substitute your own public folder name.</td></tr></tbody></table>
<p>For the second case, the project folder contains these files.</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">trail-notes/</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">├── index.html</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">├── favicon.ico</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">├── favicon-96x96.png</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">├── apple-touch-icon.png</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">└── guides/</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    └── about.html</span><br></div></code></pre></div></div>
<p>Open <code>index.html</code> in your editor. Place these three lines just before <code>&lt;/head&gt;</code>. If the page already has icon links, update their paths. Do the same in <code>guides/about.html</code>, then save both files and publish them along with the icons.</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">link</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">rel</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">icon</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">/trail-notes/favicon.ico</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">sizes</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">16x16 32x32 48x48</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">link</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">rel</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">icon</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">type</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">image/png</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">/trail-notes/favicon-96x96.png</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">sizes</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">96x96</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">link</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">rel</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">apple-touch-icon</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">/trail-notes/apple-touch-icon.png</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">sizes</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">180x180</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>The first two links give browsers a choice of tab icons. The last supplies the icon for an Apple home-screen shortcut. Both HTML pages can use the same links because each address starts at the domain root.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="check-the-icon-on-both-pages">Check the icon on both pages<a href="https://docs.phcode.dev/blog/how-to-add-a-favicon-in-html#check-the-icon-on-both-pages" class="hash-link" aria-label="Direct link to Check the icon on both pages" title="Direct link to Check the icon on both pages" translate="no">​</a></h2>
<ol>
<li class="">Open the published home page in its own browser tab. Look to the left of its title for your icon.</li>
<li class="">Open the nested About page in a second tab. It should show the same icon. If only the home page works, look for <code>href="favicon.ico"</code> on the About page. That spelling makes the browser look for <code>guides/favicon.ico</code>. Use the shared path from the example.</li>
<li class="">If the icon is missing on both pages, open its address directly on your own domain. For Trail Notes, that path is <code>/trail-notes/favicon-96x96.png</code>. You should see the image. A missing-page message or your site’s home page means the image is unavailable at that address.</li>
</ol>
<p>If the image opens directly but the tab still shows an old icon, try a fresh private window. To see which icon URL the browser requested, open developer tools, select <strong>Network</strong>, and reload the page. <a class="" href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#check-a-failed-resource">Check a failed resource in an HTML preview</a>.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="HTML" term="HTML"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Change an SVG Icon’s Fill and Stroke Colors]]></title>
        <id>https://docs.phcode.dev/blog/change-svg-fill-and-stroke</id>
        <link href="https://docs.phcode.dev/blog/change-svg-fill-and-stroke"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Recolor the inside and outline of an inline SVG separately. Try a trail-marker icon in the Phoenix HTML Editor, then download and reopen the finished page.]]></summary>
        <content type="html"><![CDATA[<p>To change the color inside an SVG shape, edit its <code>fill</code>. To change the line around it, edit its <code>stroke</code>. Try both on the trail marker below. You’ll start with an orange circle and a white border, then save a green circle with a dark border. The white arrow in the middle keeps its color.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="open-the-practice-icon">Open the practice icon<a href="https://docs.phcode.dev/blog/change-svg-fill-and-stroke#open-the-practice-icon" class="hash-link" aria-label="Direct link to Open the practice icon" title="Direct link to Open the practice icon" translate="no">​</a></h2>
<p>Open the <a href="https://phcode.dev/tools/html-editor.html" target="_blank" rel="noopener noreferrer" class="">Phoenix HTML Editor</a>. In the <strong>index.html</strong> tab, replace the example code with the block below. Leave <strong>Auto-run</strong> on, or click <strong>Run</strong> after an edit. If your screen shows separate panels, select <strong>Preview</strong> to see the icon.</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token doctype punctuation" style="color:#393A34;font-style:italic">&lt;!</span><span class="token doctype doctype-tag" style="color:#999988;font-style:italic">doctype</span><span class="token doctype" style="color:#999988;font-style:italic"> </span><span class="token doctype name" style="color:#999988;font-style:italic">html</span><span class="token doctype punctuation" style="color:#393A34;font-style:italic">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">html</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">lang</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">en</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">head</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">title</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Trail marker</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">title</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">head</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">body</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">svg</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">xmlns</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">http://www.w3.org/2000/svg</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">       </span><span class="token tag attr-name" style="color:#00a4db">width</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">160</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">height</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">160</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">viewBox</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">0 0 80 80</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">       </span><span class="token tag attr-name" style="color:#00a4db">role</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">img</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">aria-label</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">Trail marker pointing right</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">circle</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">cx</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">40</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">cy</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">40</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">r</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">32</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">            </span><span class="token tag attr-name" style="color:#00a4db">fill</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">#ff8c42</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">stroke</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">#ffffff</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">stroke-width</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">6</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag punctuation" style="color:#393A34">/&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">path</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">d</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">M29 40h22m-8-8 8 8-8 8</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">          </span><span class="token tag attr-name" style="color:#00a4db">fill</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">none</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">stroke</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">#ffffff</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">stroke-width</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">4</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">          </span><span class="token tag attr-name" style="color:#00a4db">stroke-linecap</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">round</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">stroke-linejoin</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">round</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag punctuation" style="color:#393A34">/&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">svg</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">body</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">html</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="change-one-part-at-a-time">Change one part at a time<a href="https://docs.phcode.dev/blog/change-svg-fill-and-stroke#change-one-part-at-a-time" class="hash-link" aria-label="Direct link to Change one part at a time" title="Direct link to Change one part at a time" translate="no">​</a></h2>
<ol>
<li class="">Find the line with <strong><code>&lt;circle</code></strong>. Change its <code>fill</code> from <code>#ff8c42</code> to <code>#237a58</code>. The disc turns green. The arrow stays white.</li>
<li class="">On that same circle, change <code>stroke="#ffffff"</code> to <code>stroke="#17382e"</code>. A dark green ring appears around the disc. Keep <code>stroke-width="6"</code> so the outline stays visible.</li>
<li class="">Look at the <strong><code>&lt;path</code></strong> beneath the circle. This is the arrow. Its <code>fill="none"</code> keeps its interior empty, and its white <code>stroke</code> draws the line. To recolor only the arrow in your own version, edit the stroke on this path.</li>
</ol>
<a href="https://docs.phcode.dev/tutorials/media/svg-fill-stroke-result.png"><img src="https://docs.phcode.dev/tutorials/media/svg-fill-stroke-result.png" width="711" height="310" style="height:auto" loading="lazy" alt="The HTML Editor preview shows the completed trail icon with a green disc, dark outline, and white arrow pointing right."></a>
<p>Click <strong>Download</strong> (the downward arrow) in the editor toolbar. Open the downloaded <strong>index.html</strong> in your browser. The green disc, dark ring, and white arrow should appear in that copy too. <a class="" href="https://docs.phcode.dev/blog/open-an-html-file-in-chrome">Open a downloaded HTML page in Chrome</a></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="my-html-only-shows-an-image-tag">My HTML only shows an image tag<a href="https://docs.phcode.dev/blog/change-svg-fill-and-stroke#my-html-only-shows-an-image-tag" class="hash-link" aria-label="Direct link to My HTML only shows an image tag" title="Direct link to My HTML only shows an image tag" translate="no">​</a></h2>
<p>If the page contains <code>&lt;img src="images/marker.svg" alt="Trail marker"&gt;</code>, the shapes live in <strong>images/marker.svg</strong>. Open that file in your code editor, find the shape, edit its fill or stroke there, and save. Reload the page that uses the image. A CSS <code>fill</code> on the outer <code>&lt;img&gt;</code> won’t reach the circle inside the separate file. <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorials/SVG_from_scratch/Fills_and_strokes" target="_blank" rel="noopener noreferrer" class="">SVG fill and stroke</a></p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="HTML" term="HTML"/>
        <category label="SVG" term="SVG"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Compare Two JSON Files and Read the Differences]]></title>
        <id>https://docs.phcode.dev/blog/compare-two-json-files</id>
        <link href="https://docs.phcode.dev/blog/compare-two-json-files"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Compare two JSON files in your browser. Follow a worked example to find added, removed, and changed values and see how array order affects the result.]]></summary>
        <content type="html"><![CDATA[<p>Did a setting change, or did someone just rearrange the file? Open the old version in <strong>Original JSON</strong> and the new version in <strong>Changed JSON</strong>, then click <strong>Compare JSON</strong>. Phoenix Code compares the values and shows the location of each difference. Spaces, indentation, and the order of keys in an object can change without showing up as edits.</p>
<p>You can use your own two files or paste the examples below. The free <a href="https://phcode.dev/tools/json-compare.html" target="_blank" rel="noopener noreferrer" class="">JSON Compare &amp; Diff tool</a> runs in your browser.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="compare-the-old-and-new-settings">Compare the old and new settings<a href="https://docs.phcode.dev/blog/compare-two-json-files#compare-the-old-and-new-settings" class="hash-link" aria-label="Direct link to Compare the old and new settings" title="Direct link to Compare the old and new settings" translate="no">​</a></h2>
<p>Open <a href="https://phcode.dev/tools/json-compare.html" target="_blank" rel="noopener noreferrer" class="">JSON Compare &amp; Diff</a>. If you have your own files, click <strong>Open file</strong> in <strong>Original JSON</strong> and choose the older file. Then use <strong>Open file</strong> in <strong>Changed JSON</strong> to choose the newer one.</p>
<p>To try it with Trail Notes, paste the first block into <strong>Original JSON</strong> and the second into <strong>Changed JSON</strong>.</p>
<p><strong>Original JSON</strong></p>
<div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"project"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Trail Notes"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"published"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"pages"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"home"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"walks"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"theme"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token property" style="color:#36acaa">"color"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"green"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token property" style="color:#36acaa">"logo"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"trail.svg"</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p><strong>Changed JSON</strong></p>
<div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"theme"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token property" style="color:#36acaa">"color"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"green"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token property" style="color:#36acaa">"accent"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"amber"</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"pages"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"home"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"walks"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"map"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"published"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"project"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Trail Notes"</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="read-what-changed">Read what changed<a href="https://docs.phcode.dev/blog/compare-two-json-files#read-what-changed" class="hash-link" aria-label="Direct link to Read what changed" title="Direct link to Read what changed" translate="no">​</a></h2>
<p>Click <strong>Compare JSON</strong>. For Trail Notes, the message reads <strong>Compared: 4 differences found.</strong> The toolbar shows <strong>2 added · 1 removed · 1 changed</strong>.</p>
<p>Use the <strong>up and down arrows</strong> beside the difference count to move through the results. Each stop gives you a path. For example, <code>/pages/2</code> means the third item in <code>pages</code>, because array positions start at zero.</p>
<table><thead><tr><th>Path</th><th>What happened in Trail Notes</th></tr></thead><tbody><tr><td><code>/published</code></td><td>The existing setting changed from <code>false</code> to <code>true</code>.</td></tr><tr><td><code>/pages/2</code></td><td><code>"map"</code> was added after <code>"walks"</code>.</td></tr><tr><td><code>/theme/logo</code></td><td>The <code>logo</code> field and its value <code>"trail.svg"</code> were removed.</td></tr><tr><td><code>/theme/accent</code></td><td>A new <code>accent</code> field was added with the value <code>"amber"</code>.</td></tr></tbody></table>
<a href="https://docs.phcode.dev/tutorials/media/json-compare-four-changes.png"><img src="https://docs.phcode.dev/tutorials/media/json-compare-four-changes.png" width="1250" height="625" style="height:auto" loading="lazy" alt="The second of four differences is selected. The Added label identifies /pages/2, and the Changed JSON pane highlights the new map item."></a>
<p>Click <strong>Copy differences</strong> to keep a text report. It uses <code>+</code> for an addition, <code>-</code> for a removal, and <code>~</code> for a changed value. If an addition shows up as a removal, check which version you opened in <strong>Original JSON</strong>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="why-moving-a-key-is-different-from-moving-an-array-item">Why moving a key is different from moving an array item<a href="https://docs.phcode.dev/blog/compare-two-json-files#why-moving-a-key-is-different-from-moving-an-array-item" class="hash-link" aria-label="Direct link to Why moving a key is different from moving an array item" title="Direct link to Why moving a key is different from moving an array item" translate="no">​</a></h2>
<p>The <code>project</code> key appears first in the original and last in the changed file. Its value is still <code>"Trail Notes"</code>, so it has no entry in the report. An object identifies each value by its key.</p>
<p>An array identifies items by position. To see this, replace the original pane with <code>{"pages":["home","walks"]}</code> and the changed pane with <code>{"pages":["walks","home"]}</code>. Click <strong>Compare JSON</strong> again. You’ll get <strong>2 changed</strong>. Position <code>/pages/0</code> now holds <code>"walks"</code>, and <code>/pages/1</code> now holds <code>"home"</code>.</p>
<p>To apply a change, open the source file in your editor, edit that setting, and save. Then open the saved version in <strong>Changed JSON</strong> and compare again. If you’re editing a project configuration in Phoenix Code, see <a class="" href="https://docs.phcode.dev/docs/Features/json-code-intelligence">JSON editing and error checks</a>.</p>
<p>If the comparison stops at a closing bracket, check for an extra comma after the last value. <a class="" href="https://docs.phcode.dev/blog/fix-trailing-comma-json">Find and fix a trailing comma in JSON</a>.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="JSON" term="JSON"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Build a responsive CSS Grid sidebar that stacks on phones]]></title>
        <id>https://docs.phcode.dev/blog/responsive-css-grid-sidebar</id>
        <link href="https://docs.phcode.dev/blog/responsive-css-grid-sidebar"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Make a header, sidebar, and content area in Phoenix’s CSS Grid Generator. Check the layout at two widths and open the finished HTML file in your browser.]]></summary>
        <content type="html"><![CDATA[<p>A walking guide needs room for a list of walks beside the route description. On a phone, people should be able to read the description without scrolling sideways. You can build both layouts in Phoenix’s free CSS Grid Generator and download a single HTML file that switches between them.</p>
<p>You’ll make three blocks called <strong>Trail notes</strong>, <strong>Walks</strong>, and <strong>Route details</strong>. All you need is a browser.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="set-up-the-sidebar">Set up the sidebar<a href="https://docs.phcode.dev/blog/responsive-css-grid-sidebar#set-up-the-sidebar" class="hash-link" aria-label="Direct link to Set up the sidebar" title="Direct link to Set up the sidebar" translate="no">​</a></h2>
<ol>
<li class="">Open the <a href="https://phcode.dev/tools/css-grid-generator.html" target="_blank" rel="noopener noreferrer" class="">CSS Grid Generator</a>. At the top of the builder, choose <strong>Sidebar</strong>. The first block stretches across the top. The two below it share a row.</li>
<li class="">Under <strong>Selected item</strong>, choose <strong>Item 1</strong>. Change <strong>Label</strong> to <code>Trail notes</code> and press <strong>Tab</strong>. Repeat with <strong>Item 2</strong> for <code>Walks</code> and <strong>Item 3</strong> for <code>Route details</code>. On a phone, open <strong>Layout controls</strong> to see these fields.</li>
<li class="">Under <strong>Layout</strong>, keep <strong>Stack on small screens</strong> checked. Beside <strong>Live preview</strong>, open the width menu and choose <strong>Desktop · 960px</strong>. On a phone, tap <strong>Preview &amp; code</strong> first.</li>
</ol>
<p>The preset uses four equal columns. The heading spans all four. Below it, <strong>Walks</strong> takes the first column and <strong>Route details</strong> takes the other three.</p>
<a href="https://docs.phcode.dev/tutorials/media/grid-sidebar-960.png"><img src="https://docs.phcode.dev/tutorials/media/grid-sidebar-960.png" width="908" height="565" style="height:auto" loading="lazy" alt="The 960-pixel grid preview shows Trail notes across the top, Walks in the narrow left column, and Route details beside it."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="check-what-happens-on-a-phone">Check what happens on a phone<a href="https://docs.phcode.dev/blog/responsive-css-grid-sidebar#check-what-happens-on-a-phone" class="hash-link" aria-label="Direct link to Check what happens on a phone" title="Direct link to Check what happens on a phone" translate="no">​</a></h2>
<p>Choose <strong>Mobile · 375px</strong> from the same menu. <strong>Stacked layout</strong> appears under the preview. Read from the top down and you should see <strong>Trail notes</strong>, <strong>Walks</strong>, then <strong>Route details</strong>. Each takes the full width available inside the page margins.</p>
<a href="https://docs.phcode.dev/tutorials/media/grid-sidebar-375.png"><img src="https://docs.phcode.dev/tutorials/media/grid-sidebar-375.png" width="908" height="590" style="height:auto" loading="lazy" alt="The 375-pixel preview shows the three labeled blocks in one column with Route details below Walks."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="save-and-try-the-finished-page">Save and try the finished page<a href="https://docs.phcode.dev/blog/responsive-css-grid-sidebar#save-and-try-the-finished-page" class="hash-link" aria-label="Direct link to Save and try the finished page" title="Direct link to Save and try the finished page" translate="no">​</a></h2>
<ol>
<li class="">Click <strong>Download HTML</strong> below the code. Open the downloaded <code>phoenix-grid.html</code> in your browser.</li>
<li class="">Make the window narrow, then wide again. The exported CSS uses <code>@media (max-width: 640px)</code>. At 640 CSS pixels and below you get one column. Above that width the sidebar and content sit side by side.</li>
<li class="">To use the layout for your own page, open the downloaded file in your editor and find <code>Route details</code> inside <code>&lt;body&gt;</code>. Replace that label with a route description, save, and reload the browser. Keep the three blocks in the order you want people to read them on a phone. The small-screen layout follows their order in the HTML.</li>
</ol>
<p>If your own content sticks out past the right edge after the columns stack, check whether an item inside the grid has a fixed width. <a class="" href="https://docs.phcode.dev/blog/test-website-on-different-screen-sizes">Test a page at different screen sizes</a>.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="CSS" term="CSS"/>
        <category label="HTML" term="HTML"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Decode Base64 Text and Preview an Encoded Image]]></title>
        <id>https://docs.phcode.dev/blog/decode-base64-text-and-images</id>
        <link href="https://docs.phcode.dev/blog/decode-base64-text-and-images"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Decode a UTF-8 message, check an invalid Base64 string, and display a PNG data URL in an HTML preview. Both examples work in your browser.]]></summary>
        <content type="html"><![CDATA[<p>If you have a Base64-encoded message, paste it into <strong>Base64 Encoded</strong> in the Phoenix decoder and click <strong>Decode</strong>. If you copied something starting with <code>data:image/png;base64,</code> from an HTML file, you have a picture. Here’s how to read the message and see the picture.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="decode-a-text-message">Decode a text message<a href="https://docs.phcode.dev/blog/decode-base64-text-and-images#decode-a-text-message" class="hash-link" aria-label="Direct link to Decode a text message" title="Direct link to Decode a text message" translate="no">​</a></h2>
<ol>
<li class="">
<p>Open the <a href="https://phcode.dev/tools/base64-encode-decode.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Base64 Encoder &amp; Decoder</a>. Find the box labeled <strong>Base64 Encoded</strong>.</p>
</li>
<li class="">
<p>Copy this whole string into the box, including the two equals signs at the end.</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">Q2Fmw6kgYnkgdGhlIHRyYWlsLg==</span><br></div></code></pre></div></div>
</li>
<li class="">
<p>Click <strong>Decode</strong> below that box. The <strong>Text</strong> box should now read <strong>Café by the trail.</strong> The accent in <em>Café</em> is part of the original UTF-8 text. Click <strong>Copy</strong> beside <strong>Text</strong> to keep the readable version.</p>
</li>
<li class="">
<p>To check it the other way, click <strong>Encode</strong> beneath the text. You should get the original string back, including its ending.</p>
</li>
</ol>
<a href="https://docs.phcode.dev/tutorials/media/base64-text-decoded.png"><img src="https://docs.phcode.dev/tutorials/media/base64-text-decoded.png" width="1052" height="390" style="height:auto" loading="lazy" alt="The Text box contains Café by the trail. and the Base64 Encoded box contains the matching encoded string."></a>
<p>If the tool reports <strong>Invalid Base64 string</strong>, recopy the complete value. For example, <code>Q2Fm%</code> produces that error. Check for punctuation copied from the surrounding sentence or quotation marks from the HTML. A Base64 string by itself doesn’t tell you which kind of file it contains.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="see-an-image-copied-from-html">See an image copied from HTML<a href="https://docs.phcode.dev/blog/decode-base64-text-and-images#see-an-image-copied-from-html" class="hash-link" aria-label="Direct link to See an image copied from HTML" title="Direct link to See an image copied from HTML" translate="no">​</a></h2>
<p>In a data URL, the part before the comma describes what follows. In <code>data:image/png;base64,...</code>, the type is PNG and the rest represents the image bytes. Keep the prefix and the bytes together when you use the URL as an image source. <a href="https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data" target="_blank" rel="noopener noreferrer" class="">Data URL syntax</a></p>
<p>Open the <a href="https://phcode.dev/tools/html-viewer.html" target="_blank" rel="noopener noreferrer" class="">Phoenix HTML Viewer</a> and paste this complete image tag into <strong>HTML source</strong>. If the Viewer shows tabs, click <strong>Preview</strong>.</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">img</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">width</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">64</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">height</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">64</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">alt</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">Green square</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">  </span><span class="token tag attr-name" style="color:#00a4db">src</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAADElEQVQImWPQqwkCAAHYAP0XYDMkAAAAAElFTkSuQmCC</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>The preview shows a green square. The example PNG contains one green pixel. The HTML displays it at <strong>64 × 64</strong> so you can see it. If you see a broken-image icon, check that the comma and the start and end of the encoded data all made it inside the quotes. <a class="" href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript">Troubleshoot missing images in an HTML preview</a></p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="HTML" term="HTML"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Change All Caps to Sentence Case on a Website]]></title>
        <id>https://docs.phcode.dev/blog/change-all-caps-website-text</id>
        <link href="https://docs.phcode.dev/blog/change-all-caps-website-text"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Fix a heading typed in all caps, or one that CSS displays in uppercase. Try both cases with a short HTML example and check the saved result.]]></summary>
        <content type="html"><![CDATA[<p>You change a heading to “Meet at the NASA exhibit,” save the file, and the page still shows <strong>MEET AT THE NASA EXHIBIT</strong>. Open the HTML and look between the heading tags. If the words are uppercase there, edit the text. If they already look right there, check the CSS.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="when-the-letters-in-the-file-are-all-capitals">When the letters in the file are all capitals<a href="https://docs.phcode.dev/blog/change-all-caps-website-text#when-the-letters-in-the-file-are-all-capitals" class="hash-link" aria-label="Direct link to When the letters in the file are all capitals" title="Direct link to When the letters in the file are all capitals" translate="no">​</a></h2>
<ol>
<li class="">
<p>Open the <a href="https://phcode.dev/tools/case-converter.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Case Converter</a>. Paste this example into <strong>Your text</strong>.</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">MEET AT THE NASA EXHIBIT. BRING A MAP.</span><br></div></code></pre></div></div>
</li>
<li class="">
<p>Under <strong>For writing</strong>, click <strong>Sentence case</strong>. The result is <strong>Meet at the NASA exhibit. Bring a map.</strong> If you choose <strong>lowercase</strong> instead, you get <strong>meet at the nasa exhibit. bring a map.</strong> That choice also changes the acronym.</p>
</li>
<li class="">
<p>Read through names, initials, and brand spellings before copying. Click <strong>Copy</strong>, replace only the words between the heading’s opening and closing tags, and save your HTML file. For example, the first sentence could become <code>&lt;h1&gt;Meet at the NASA exhibit&lt;/h1&gt;</code>.</p>
</li>
</ol>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="when-the-html-looks-right-but-the-page-is-still-uppercase">When the HTML looks right but the page is still uppercase<a href="https://docs.phcode.dev/blog/change-all-caps-website-text#when-the-html-looks-right-but-the-page-is-still-uppercase" class="hash-link" aria-label="Direct link to When the HTML looks right but the page is still uppercase" title="Direct link to When the HTML looks right but the page is still uppercase" translate="no">​</a></h2>
<p>Paste this example into <strong>HTML source</strong> in the <a href="https://phcode.dev/tools/html-viewer.html" target="_blank" rel="noopener noreferrer" class="">Phoenix HTML Viewer</a>. Choose <strong>Preview</strong> if the source and preview appear as tabs.</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">style</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">  </span><span class="token style language-css selector" style="color:#00009f">h1</span><span class="token style language-css"> </span><span class="token style language-css punctuation" style="color:#393A34">{</span><span class="token style language-css"> </span><span class="token style language-css property" style="color:#36acaa">text-transform</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> uppercase</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"> </span><span class="token style language-css punctuation" style="color:#393A34">}</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">style</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Meet at the NASA exhibit</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>The heading in the preview reads <strong>MEET AT THE NASA EXHIBIT</strong>. The letters between the <code>&lt;h1&gt;</code> tags still have their original spelling.</p>
<a href="https://docs.phcode.dev/tutorials/media/case-heading-css.png"><img src="https://docs.phcode.dev/tutorials/media/case-heading-css.png" width="1032" height="265" style="height:auto" loading="lazy" alt="The HTML source mixes uppercase and lowercase letters in Meet at the NASA exhibit. The live preview displays the entire heading in capitals."></a>
<p>Change <code>text-transform: uppercase;</code> to <code>text-transform: none;</code>. The preview now reads <strong>Meet at the NASA exhibit</strong>. The <code>none</code> value lets the text display as you typed it, including the capitals in NASA. <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/text-transform" target="_blank" rel="noopener noreferrer" class="">CSS text-transform</a></p>
<p>On your own site, look for <code>text-transform</code> in the stylesheet that applies to the heading. If the file contains several matches, check the selector before editing. The example’s <code>h1</code> rule affects every first-level heading. To change only this one, give it a class such as <code>exhibit-title</code> and add <code>.exhibit-title { text-transform: none; }</code> to the stylesheet. Save, reload the page, and check another heading as well. <a class="" href="https://docs.phcode.dev/docs/Features/find-in-files">Find text across project files in Phoenix Code</a></p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="HTML" term="HTML"/>
        <category label="CSS" term="CSS"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Get a Hex Color From an Image and Use It in CSS]]></title>
        <id>https://docs.phcode.dev/blog/get-hex-color-from-image</id>
        <link href="https://docs.phcode.dev/blog/get-hex-color-from-image"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Pick an exact pixel from a logo, copy its hex code, and test two text colors against it. Follow along with a downloadable trail marker.]]></summary>
        <content type="html"><![CDATA[<p>Suppose you want a label on your website to match the orange on a trail sign. Which orange should you copy, and will white lettering be readable on it? You can answer both questions using the picture itself. In this example the orange is <code>#FF8C42</code>. Dark text on it measures <strong>7.75:1</strong> for contrast.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="pick-one-pixel-from-the-picture">Pick one pixel from the picture<a href="https://docs.phcode.dev/blog/get-hex-color-from-image#pick-one-pixel-from-the-picture" class="hash-link" aria-label="Direct link to Pick one pixel from the picture" title="Direct link to Pick one pixel from the picture" translate="no">​</a></h2>
<ol>
<li class="">Save the <a href="https://docs.phcode.dev/tutorials/trail-marker/trail-marker.webp" download="trail-marker.webp">practice trail marker</a>, or use your own logo. Open the <a href="https://phcode.dev/tools/image-color-picker.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Image Color Picker</a>, click <strong>Choose image</strong>, and select the file.</li>
<li class="">Click a flat patch of orange inside the sign. <strong>Pixel magnifier</strong> shows the spot you picked. An edge pixel can be partly transparent, so move a little farther inside if you want the solid color.</li>
<li class="">To pick the exact practice pixel, go to <strong>Source coordinates</strong>, enter <strong>60</strong> in <strong>X</strong> and <strong>80</strong> in <strong>Y</strong>, and click <strong>Sample pixel</strong>. The coordinates count from the top-left corner of the original image.</li>
<li class="">Under <strong>Selected pixel values</strong>, find <strong>HEX / HEXA</strong>. Click the copy icon beside it. For the marker, you should get <code>#FF8C42</code>. If you sample X <strong>5</strong>, Y <strong>5</strong> instead, you get <code>#00000000</code>. The final <code>00</code> means that corner is fully transparent. Return to <strong>60</strong>, <strong>80</strong> before copying the orange.</li>
</ol>
<a href="https://docs.phcode.dev/tutorials/media/image-pixel-coordinates.png"><img src="https://docs.phcode.dev/tutorials/media/image-pixel-coordinates.png" width="443" height="215" style="height:auto" loading="lazy" alt="Source coordinates in the Image Color Picker show X 60 and Y 80 above the Sample pixel controls."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="choose-the-lettering">Choose the lettering<a href="https://docs.phcode.dev/blog/get-hex-color-from-image#choose-the-lettering" class="hash-link" aria-label="Direct link to Choose the lettering" title="Direct link to Choose the lettering" translate="no">​</a></h2>
<p>Open the <a href="https://phcode.dev/tools/color-contrast-checker.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Color Contrast Checker</a>. Paste <code>#FF8C42</code> into <strong>Background</strong> and leave both color layers at full opacity. Enter each of the following values in <strong>Foreground</strong> and read the <strong>AA normal text</strong> result.</p>
<table><thead><tr><th>Text color on the orange</th><th>Contrast ratio</th><th>Result for ordinary text</th></tr></thead><tbody><tr><td>White, <code>#FFFFFF</code></td><td>2.31:1</td><td>Does not pass</td></tr><tr><td>Near-black, <code>#171717</code></td><td>7.75:1</td><td>Passes</td></tr></tbody></table>
<p>The usual WCAG AA minimum for ordinary text is 4.5:1. The white lettering can look crisp on a large graphic and still be hard to read on a small label. <a href="https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html" target="_blank" rel="noopener noreferrer" class="">W3C guidance on minimum contrast</a></p>
<a href="https://docs.phcode.dev/tutorials/media/marker-text-contrast.png"><img src="https://docs.phcode.dev/tutorials/media/marker-text-contrast.png" width="604" height="575" style="height:auto" loading="lazy" alt="The contrast checker marks AA normal text and AA large text as passing for the dark lettering on the sampled orange background."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="apply-the-two-colors-to-a-label">Apply the two colors to a label<a href="https://docs.phcode.dev/blog/get-hex-color-from-image#apply-the-two-colors-to-a-label" class="hash-link" aria-label="Direct link to Apply the two colors to a label" title="Direct link to Apply the two colors to a label" translate="no">​</a></h2>
<p>In your page’s HTML, put <code>&lt;span class="trail-label"&gt;Woodland loop&lt;/span&gt;</code> where you want the label. Add this rule to the stylesheet the page uses, then save and open the page in Live Preview.</p>
<div class="language-css codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-css codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token selector class" style="color:#00009f">.trail-label</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">color</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token hexcode color">#171717</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">background-color</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token hexcode color">#ff8c42</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">padding</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.25</span><span class="token unit">em</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0.5</span><span class="token unit">em</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>You should see dark lettering on the same orange you picked from the marker. If your real label sits on a photo or uses a translucent overlay, sample and check the background behind the letters as well. <a class="" href="https://docs.phcode.dev/docs/editing-colors">Editing colors in Phoenix Code</a></p>
<p>If the logo is an SVG, you can <a class="" href="https://docs.phcode.dev/blog/change-svg-fill-and-stroke">recolor one shape in its source</a>. If an upload form asks for a JPG, you can <a class="" href="https://docs.phcode.dev/blog/convert-webp-to-jpg-background">replace the transparent corners with your page’s background color</a>.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="CSS" term="CSS"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Find and fix a trailing comma in JSON]]></title>
        <id>https://docs.phcode.dev/blog/fix-trailing-comma-json</id>
        <link href="https://docs.phcode.dev/blog/fix-trailing-comma-json"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Use the reported line and column to find an extra comma in a JSON array or object. Try a broken example, keep the comma inside a place name, and save the corrected file.]]></summary>
        <content type="html"><![CDATA[<p>In JSON, a comma tells the reader to expect another value or property. A comma immediately before the closing <code>]</code> or <code>}</code> is a <strong>trailing comma</strong> and makes the file invalid. A comma inside quoted text is an ordinary character. Removing every comma can break the file and change your data.</p>
<p>Here’s how to find the extra comma in a list of stops, keep the place name <strong>Lake, north</strong> intact, and save the corrected file.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="find-the-error">Find the error<a href="https://docs.phcode.dev/blog/fix-trailing-comma-json#find-the-error" class="hash-link" aria-label="Direct link to Find the error" title="Direct link to Find the error" translate="no">​</a></h2>
<ol>
<li class="">Open the <a href="https://phcode.dev/tools/json-formatter.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Code JSON Formatter</a>. Paste the example below into <strong>Input JSON</strong>. If you’re checking a file of your own, choose <strong>Open file</strong> instead.</li>
<li class="">Click <strong>Validate</strong>. For this exact example, the red message points to <strong>line 3, column 39</strong>. That position is the closing square bracket. The character immediately before it is the extra comma.</li>
</ol>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">{</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  "walk": "Woodland loop",</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  "stops": ["Oak gate", "Lake, north",],</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  "open": true</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">}</span><br></div></code></pre></div></div>
<a href="https://docs.phcode.dev/tutorials/media/json-trailing-comma-error.png"><img src="https://docs.phcode.dev/tutorials/media/json-trailing-comma-error.png" width="1230" height="483" style="height:auto" loading="lazy" alt="The JSON Formatter shows the sample under Input JSON and points to line 3, column 39, where the stops array closes after an extra comma."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="remove-the-one-extra-comma">Remove the one extra comma<a href="https://docs.phcode.dev/blog/fix-trailing-comma-json#remove-the-one-extra-comma" class="hash-link" aria-label="Direct link to Remove the one extra comma" title="Direct link to Remove the one extra comma" translate="no">​</a></h2>
<p>In <strong>Input JSON</strong>, replace the <code>stops</code> line with the one below.</p>
<div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"stops"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"Oak gate"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Lake, north"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><br></div></code></pre></div></div>
<p>The comma between the two stops separates two values. The comma inside <code>"Lake, north"</code> belongs to the name. The comma after the closing <code>]</code> also stays, because the <code>open</code> property follows on the next line.</p>
<p>Click <strong>Validate</strong> again. You should see <strong>Valid JSON</strong>. Then click <strong>Format</strong> and choose <strong>Download</strong> above the result. Open <code>formatted.json</code> from your downloads and check that the second stop still reads <code>"Lake, north"</code>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-if-the-error-points-to-a-closing-brace">What if the error points to a closing brace?<a href="https://docs.phcode.dev/blog/fix-trailing-comma-json#what-if-the-error-points-to-a-closing-brace" class="hash-link" aria-label="Direct link to What if the error points to a closing brace?" title="Direct link to What if the error points to a closing brace?" translate="no">​</a></h2>
<p>The same rule applies to objects. For example, <code>{"open": true,}</code> has a comma after its last property. Change it to <code>{"open": true}</code>. A parser can report the closing character because that’s where it discovers the expected next value or property is missing. <a href="https://www.rfc-editor.org/rfc/rfc8259#section-4" target="_blank" rel="noopener noreferrer" class="">JSON object and array syntax</a>.</p>
<p>If both versions of your file now validate and you want to see whether any values changed, <a class="" href="https://docs.phcode.dev/blog/compare-two-json-files">compare the two JSON files</a>.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="JSON" term="JSON"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Convert Markdown to PDF with Page Breaks]]></title>
        <id>https://docs.phcode.dev/blog/convert-markdown-to-pdf-with-page-breaks</id>
        <link href="https://docs.phcode.dev/blog/convert-markdown-to-pdf-with-page-breaks"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Convert a Markdown README to a two-page PDF in your browser. Try the sample file, add a page break, and check that the table and code survive export.]]></summary>
        <content type="html"><![CDATA[<p>To convert a Markdown file to PDF, open it in the <a href="https://phcode.dev/tools/markdown-to-pdf.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Code Markdown to PDF Converter</a>, choose <strong>Save as PDF</strong>, then save from your browser’s print dialog. If you want a section to start on a new page, you can mark that spot in the Markdown.</p>
<p>Try it with a short project README. The finished handout has a file table and a CSS example on page one, followed by a checklist on page two. You can do this in a browser without installing an editor or extension.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="open-the-readme-and-check-the-preview">Open the README and check the preview<a href="https://docs.phcode.dev/blog/convert-markdown-to-pdf-with-page-breaks#open-the-readme-and-check-the-preview" class="hash-link" aria-label="Direct link to Open the README and check the preview" title="Direct link to Open the README and check the preview" translate="no">​</a></h2>
<ol>
<li class="">Save <a href="https://docs.phcode.dev/tutorials/markdown-pdf/trail-notes.md" download="trail-notes.md">the example Markdown file</a>, or use a <code>.md</code> file of your own.</li>
<li class="">Open the <a href="https://phcode.dev/tools/markdown-to-pdf.html" target="_blank" rel="noopener noreferrer" class="">converter</a>, click <strong>Open file</strong>, and select your file. If you already have the text on your clipboard, paste it into <strong>Markdown source</strong>.</li>
<li class="">Under <strong>PDF page preview</strong>, look for the heading <strong>Trail Notes release handoff</strong>, a two-row table, and the CSS rule for <code>.route-label</code>. On a narrow screen, tap <strong>Preview</strong> to switch from the source to the rendered page.</li>
</ol>
<a href="https://docs.phcode.dev/tutorials/markdown-pdf/converter-preview.png"><img src="https://docs.phcode.dev/tutorials/markdown-pdf/converter-preview.png" width="1175" height="650" style="height:auto" loading="lazy" alt="Phoenix Code shows the README beside its rendered table, CSS rule, and checklist. The toolbar shows A4 paper, Normal margins, Page numbers, and Save as PDF."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="start-the-checklist-on-a-new-page">Start the checklist on a new page<a href="https://docs.phcode.dev/blog/convert-markdown-to-pdf-with-page-breaks#start-the-checklist-on-a-new-page" class="hash-link" aria-label="Direct link to Start the checklist on a new page" title="Direct link to Start the checklist on a new page" translate="no">​</a></h2>
<p>The sample already contains a page break. For your own README, place <code>&lt;!-- pagebreak --&gt;</code> on a line by itself just before the heading you want on the next page. Leave a blank line above and below the marker. Put it outside any fenced code block so the converter reads it as an instruction.</p>
<div class="language-markdown codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-markdown codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">&lt;!-- pagebreak --&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important punctuation" style="color:#393A34">##</span><span class="token title important"> Before you publish</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token list punctuation" style="color:#393A34">1.</span><span class="token plain"> Open the home page.</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token list punctuation" style="color:#393A34">2.</span><span class="token plain"> Check the route label and the weekend walk link.</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token list punctuation" style="color:#393A34">3.</span><span class="token plain"> Save a copy of this handout.</span><br></div></code></pre></div></div>
<p>In the converter preview, <strong>Before you publish</strong> still appears just below the CSS example. The print dialog shows where one sheet ends and the next begins.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="save-and-check-the-two-page-pdf">Save and check the two-page PDF<a href="https://docs.phcode.dev/blog/convert-markdown-to-pdf-with-page-breaks#save-and-check-the-two-page-pdf" class="hash-link" aria-label="Direct link to Save and check the two-page PDF" title="Direct link to Save and check the two-page PDF" translate="no">​</a></h2>
<ol>
<li class="">In the converter toolbar, set <strong>Paper</strong> to <strong>A4</strong> and <strong>Margins</strong> to <strong>Normal</strong> to match the example. For US Letter paper, choose <strong>Letter</strong>. If your browser shows <strong>Page numbers</strong>, turn it on to number the sheets.</li>
<li class="">Click <strong>Save as PDF</strong> in the converter. In Chrome’s print dialog, choose <strong>Save as PDF</strong> under <strong>Destination</strong>. For the sample, check that the print preview shows two pages.</li>
<li class="">Click <strong>Save</strong>, pick a folder, and name the file <code>trail-notes.pdf</code>. Open the saved PDF. On page one, search for <code>#256347</code> or select the CSS rule with your mouse. Page two should begin with <strong>Before you publish</strong>.</li>
</ol>
<p>You can check your result against the <a href="https://docs.phcode.dev/tutorials/markdown-pdf/trail-notes.pdf">PDF saved from the example</a>. If the checklist stayed on page one, look for a code block above the marker that still needs its closing three backticks. If your PDF includes the converter’s toolbar, use the converter’s <strong>Save as PDF</strong> button to print the document.</p>
<p>If you want to keep editing the README in Phoenix Code, open the original <code>.md</code> file there. <a class="" href="https://docs.phcode.dev/docs/Pro%20Features/markdown-editor">Editing Markdown with Live Preview</a>.</p>
<p>If a table cell splits at a vertical bar or the numbers are hard to compare, fix the table in the Markdown before printing. <a class="" href="https://docs.phcode.dev/blog/make-a-markdown-table">Make a Markdown table with aligned columns</a>.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="Markdown" term="Markdown"/>
        <category label="PDF" term="PDF"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Make a Markdown table with aligned columns]]></title>
        <id>https://docs.phcode.dev/blog/make-a-markdown-table</id>
        <link href="https://docs.phcode.dev/blog/make-a-markdown-table"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Build a GitHub-style Markdown table, line up distances on the right, and put a literal pipe inside a cell. Preview the example and download its HTML.]]></summary>
        <content type="html"><![CDATA[<p>A Markdown table starts with a heading row and a row of dashes. A vertical bar, also called a pipe (<code>|</code>), separates the cells. For a numeric column, put a colon after its dashes (<code>---:</code>) to line up the values on the right.</p>
<p>Try it with a walking club’s README. The table needs to keep distances in one column and show the meeting point <strong>Gate A | East car park</strong> in a single cell.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="paste-the-table-into-a-preview">Paste the table into a preview<a href="https://docs.phcode.dev/blog/make-a-markdown-table#paste-the-table-into-a-preview" class="hash-link" aria-label="Direct link to Paste the table into a preview" title="Direct link to Paste the table into a preview" translate="no">​</a></h2>
<p>Open the <a href="https://phcode.dev/tools/markdown-viewer.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Code Markdown Viewer</a> and paste this example into <strong>Markdown source</strong>. You can also <a href="https://docs.phcode.dev/tutorials/markdown-table/weekend-walks.md" download="weekend-walks.md">download the example Markdown file</a> and choose <strong>Open file</strong>. On a narrow screen, tap <strong>Preview</strong> to see the result.</p>
<div class="language-markdown codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-markdown codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token title important punctuation" style="color:#393A34">#</span><span class="token title important"> Weekend walks</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token table table-header-row punctuation" style="color:#393A34">|</span><span class="token table table-header-row table-header important"> Walk </span><span class="token table table-header-row punctuation" style="color:#393A34">|</span><span class="token table table-header-row table-header important"> Distance (km) </span><span class="token table table-header-row punctuation" style="color:#393A34">|</span><span class="token table table-header-row table-header important"> Meeting point </span><span class="token table table-header-row punctuation" style="color:#393A34">|</span><span class="token table table-header-row"></span><br></div><div class="token-line" style="color:#393A34"><span class="token table table-header-row"></span><span class="token table table-line punctuation" style="color:#393A34">|</span><span class="token table table-line"> </span><span class="token table table-line punctuation" style="color:#393A34">:---</span><span class="token table table-line"> </span><span class="token table table-line punctuation" style="color:#393A34">|</span><span class="token table table-line"> </span><span class="token table table-line punctuation" style="color:#393A34">---:</span><span class="token table table-line"> </span><span class="token table table-line punctuation" style="color:#393A34">|</span><span class="token table table-line"> </span><span class="token table table-line punctuation" style="color:#393A34">:---</span><span class="token table table-line"> </span><span class="token table table-line punctuation" style="color:#393A34">|</span><span class="token table table-line"></span><br></div><div class="token-line" style="color:#393A34"><span class="token table table-line"></span><span class="token table table-data-rows punctuation" style="color:#393A34">|</span><span class="token table table-data-rows table-data"> Woodland loop </span><span class="token table table-data-rows punctuation" style="color:#393A34">|</span><span class="token table table-data-rows table-data"> 4 </span><span class="token table table-data-rows punctuation" style="color:#393A34">|</span><span class="token table table-data-rows table-data"> Gate A \| East car park </span><span class="token table table-data-rows punctuation" style="color:#393A34">|</span><span class="token table table-data-rows"></span><br></div><div class="token-line" style="color:#393A34"><span class="token table table-data-rows"></span><span class="token table table-data-rows punctuation" style="color:#393A34">|</span><span class="token table table-data-rows table-data"> River path </span><span class="token table table-data-rows punctuation" style="color:#393A34">|</span><span class="token table table-data-rows table-data"> 12 </span><span class="token table table-data-rows punctuation" style="color:#393A34">|</span><span class="token table table-data-rows table-data"> Footbridge </span><span class="token table table-data-rows punctuation" style="color:#393A34">|</span><br></div></code></pre></div></div>
<p>Look for three columns under <strong>Weekend walks</strong>. The <strong>4</strong> sits directly above the last digit of <strong>12</strong>. The first meeting point shows a vertical bar between <strong>Gate A</strong> and <strong>East car park</strong>. The backslash is gone.</p>
<a href="https://docs.phcode.dev/tutorials/media/markdown-table-preview.png"><img src="https://docs.phcode.dev/tutorials/media/markdown-table-preview.png" width="1230" height="492" style="height:auto" loading="lazy" alt="Markdown source and its rendered table appear side by side. The distances 4 and 12 line up on the right, and Gate A | East car park stays in one cell."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="change-the-alignment-or-add-a-row">Change the alignment or add a row<a href="https://docs.phcode.dev/blog/make-a-markdown-table#change-the-alignment-or-add-a-row" class="hash-link" aria-label="Direct link to Change the alignment or add a row" title="Direct link to Change the alignment or add a row" translate="no">​</a></h2>
<p>The second line of the table controls how each column looks. Use <code>:---</code> for left, <code>:---:</code> for center, or <code>---:</code> for right. Leave a blank line between a preceding paragraph and the table, and keep one stretch of dashes for each heading. <a href="https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables" target="_blank" rel="noopener noreferrer" class="">GitHub’s guide to Markdown tables</a>.</p>
<p>To add another walk, put this line immediately after the <strong>River path</strong> row in the source. The preview should gain a third walk, with <strong>7</strong> under the other distances.</p>
<div class="language-markdown codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-markdown codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">| Hill climb | 7 | West gate |</span><br></div></code></pre></div></div>
<p>If part of a cell disappears, look for a pipe in its text. In this example, changing <code>\|</code> to <code>|</code> splits the meeting point and puts <strong>East car park</strong> beyond the table’s three columns. Put the backslash back to keep the whole name together.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="save-the-version-you-need">Save the version you need<a href="https://docs.phcode.dev/blog/make-a-markdown-table#save-the-version-you-need" class="hash-link" aria-label="Direct link to Save the version you need" title="Direct link to Save the version you need" translate="no">​</a></h2>
<p>For a GitHub README, copy the Markdown source into <code>README.md</code>, save it, and use GitHub’s <strong>Preview</strong> when you edit the file there. To share a page someone can open directly in a browser, choose <strong>Download HTML</strong> in the viewer. Open the downloaded file and check the meeting point and distances once more. For a printed handout, <a class="" href="https://docs.phcode.dev/blog/convert-markdown-to-pdf-with-page-breaks">turn your Markdown into a PDF</a>.</p>
<p>If your table is already in a Word document, you can convert the file and check the cells in the same viewer. <a class="" href="https://docs.phcode.dev/blog/convert-word-to-markdown">Convert a Word document to Markdown</a>.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="Markdown" term="Markdown"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Open an HTML File in Chrome]]></title>
        <id>https://docs.phcode.dev/blog/open-an-html-file-in-chrome</id>
        <link href="https://docs.phcode.dev/blog/open-an-html-file-in-chrome"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Open a local HTML file in desktop Chrome, check its images and styles, view the source, and reload a saved edit. Try it with a small practice website.]]></summary>
        <content type="html"><![CDATA[<p>In desktop Chrome, press <strong>Ctrl+O</strong> on Windows or Linux, or <strong>Command+O</strong> on a Mac. Select your <code>.html</code> file and click <strong>Open</strong>. Chrome displays the page directly from your computer, even before you publish it.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="open-a-page-from-a-folder">Open a page from a folder<a href="https://docs.phcode.dev/blog/open-an-html-file-in-chrome#open-a-page-from-a-folder" class="hash-link" aria-label="Direct link to Open a page from a folder" title="Direct link to Open a page from a folder" translate="no">​</a></h2>
<ol>
<li class="">Find the HTML file you want to open. To follow along, download the <a href="https://docs.phcode.dev/tutorials/first-website.zip" download="first-website.zip">Trail Notes practice website</a> and extract the ZIP. Open the extracted <code>first-website</code> folder. Keep <code>index.html</code>, <code>styles.css</code>, and the <code>images</code> folder together.</li>
<li class="">Click the <strong>+</strong> beside the current Chrome tab to open a new tab. Use <strong>Ctrl+O</strong> or <strong>Command+O</strong> to open the file picker. Browse to the extracted folder, select <strong>index.html</strong>, then click <strong>Open</strong>.</li>
<li class="">Look for <strong>A little time outside.</strong> above an illustration of a winding trail. The address bar shows <strong>File</strong> and a path ending in <code>first-website/index.html</code>. Click <strong>About</strong> to open the second page, <strong>Small walks. Good stories.</strong> Use Chrome’s back arrow to return.</li>
</ol>
<a href="https://docs.phcode.dev/tutorials/media/chrome-local-html.png"><img src="https://docs.phcode.dev/tutorials/media/chrome-local-html.png" width="1004" height="860" style="height:auto" loading="lazy" alt="Chrome labels the address File and shows first-website/index.html. The Trail Notes home page has a green heading, an About link, and an illustration of a winding trail."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="see-the-html-and-check-a-saved-change">See the HTML and check a saved change<a href="https://docs.phcode.dev/blog/open-an-html-file-in-chrome#see-the-html-and-check-a-saved-change" class="hash-link" aria-label="Direct link to See the HTML and check a saved change" title="Direct link to See the HTML and check a saved change" translate="no">​</a></h2>
<p>To read the tags behind the page, press <strong>Ctrl+U</strong> on Windows or Linux, or <strong>Command+Option+U</strong> on a Mac. Chrome opens a second tab whose address starts with <code>view-source:</code>. In the sample, the line containing <code>href="styles.css"</code> tells Chrome which stylesheet to load. <a href="https://support.google.com/chrome/answer/157179?hl=en" target="_blank" rel="noopener noreferrer" class="">Chrome keyboard shortcuts</a></p>
<a href="https://docs.phcode.dev/tutorials/media/chrome-local-html-source.png"><img src="https://docs.phcode.dev/tutorials/media/chrome-local-html-source.png" width="1000" height="248" style="height:auto" loading="lazy" alt="The Chrome source tab shows view-source: before the local file path. Below it, the HTML head links to styles.css."></a>
<p>To change the heading, open the same <code>index.html</code> in a text editor such as Phoenix Code. Find <code>&lt;h1&gt;A little time outside.&lt;/h1&gt;</code>, change the words between the tags to <code>My weekend walks.</code>, and save the file. Return to the <strong>Home | Trail Notes</strong> tab and click <strong>Reload</strong>, the circular arrow beside the address bar. The new heading should appear.</p>
<p>Once the page looks right on your computer, check a phone width too. <a class="" href="https://docs.phcode.dev/blog/test-website-on-different-screen-sizes">Test your website on different screen sizes</a></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="why-do-i-see-tags-or-a-missing-image">Why do I see tags or a missing image?<a href="https://docs.phcode.dev/blog/open-an-html-file-in-chrome#why-do-i-see-tags-or-a-missing-image" class="hash-link" aria-label="Direct link to Why do I see tags or a missing image?" title="Direct link to Why do I see tags or a missing image?" translate="no">​</a></h2>
<ul>
<li class=""><strong>The entire tab shows HTML tags.</strong> If the address starts with <code>view-source:</code>, switch back to the page tab. If the filename ends in <code>.html.txt</code>, Chrome is opening a text file. Save the HTML as plain text named <code>index.html</code> in your editor, then open that file in Chrome.</li>
<li class=""><strong>The heading appears, but the page looks plain or the trail is missing.</strong> Check that you extracted the whole ZIP. For this sample, <code>styles.css</code> belongs beside <code>index.html</code>, and <code>trail.svg</code> belongs inside <code>images</code>.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="can-i-preview-just-one-html-file-online">Can I preview just one HTML file online?<a href="https://docs.phcode.dev/blog/open-an-html-file-in-chrome#can-i-preview-just-one-html-file-online" class="hash-link" aria-label="Direct link to Can I preview just one HTML file online?" title="Direct link to Can I preview just one HTML file online?" translate="no">​</a></h2>
<p>Yes. Open the <a href="https://phcode.dev/tools/html-viewer.html" target="_blank" rel="noopener noreferrer" class="">Phoenix HTML Viewer</a>, click <strong>Open .html file</strong>, and select your file. If you see <strong>Source</strong> and <strong>Preview</strong> tabs, select <strong>Preview</strong>. The Viewer reads the chosen document. With the Trail Notes sample, it shows the heading, while the separate stylesheet and illustration stay in your project folder. To see the complete sample, open the local <code>index.html</code> directly in Chrome. <a class="" href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript">Troubleshoot missing CSS, images, or JavaScript in the Viewer</a></p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="HTML" term="HTML"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Test Your Website on Different Screen Sizes]]></title>
        <id>https://docs.phcode.dev/blog/test-website-on-different-screen-sizes</id>
        <link href="https://docs.phcode.dev/blog/test-website-on-different-screen-sizes"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Preview one HTML page at desktop, tablet, and phone widths. Find the card that makes the phone scroll sideways, fix its CSS, and check all three sizes again.]]></summary>
        <content type="html"><![CDATA[<p>The <strong>Woodland loop</strong> card below fits on a laptop and a tablet. On a phone, the distance disappears off the right edge. Try the three screen widths in the free Phoenix HTML Viewer, then add one line of CSS to bring <strong>2 miles</strong> back into view.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="open-the-same-page-at-three-widths">Open the same page at three widths<a href="https://docs.phcode.dev/blog/test-website-on-different-screen-sizes#open-the-same-page-at-three-widths" class="hash-link" aria-label="Direct link to Open the same page at three widths" title="Direct link to Open the same page at three widths" translate="no">​</a></h2>
<ol>
<li class="">Open the <a href="https://phcode.dev/tools/html-viewer.html" target="_blank" rel="noopener noreferrer" class="">Phoenix HTML Viewer</a>. Paste the whole example below into <strong>HTML source</strong>, replacing any text already there. If you see separate <strong>Source</strong> and <strong>Preview</strong> tabs, paste into <strong>Source</strong> and switch to <strong>Preview</strong>.</li>
<li class="">Under <strong>Rendered preview</strong>, open the screen-width menu. It initially reads <strong>Responsive</strong>. Select <strong>Desktop</strong>, then <strong>Tablet</strong>, then <strong>Mobile</strong>. Look for <strong>2 miles</strong> on the right of the green card each time.</li>
</ol>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token doctype punctuation" style="color:#393A34;font-style:italic">&lt;!</span><span class="token doctype doctype-tag" style="color:#999988;font-style:italic">doctype</span><span class="token doctype" style="color:#999988;font-style:italic"> </span><span class="token doctype name" style="color:#999988;font-style:italic">html</span><span class="token doctype punctuation" style="color:#393A34;font-style:italic">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">html</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">lang</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">en</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">head</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">meta</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">name</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">viewport</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">content</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">width=device-width, initial-scale=1</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">title</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Weekend walks</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">title</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">style</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">    </span><span class="token style language-css selector" style="color:#00009f">body</span><span class="token style language-css"> </span><span class="token style language-css punctuation" style="color:#393A34">{</span><span class="token style language-css"> </span><span class="token style language-css property" style="color:#36acaa">margin</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css number" style="color:#36acaa">0</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"> </span><span class="token style language-css property" style="color:#36acaa">font</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css number" style="color:#36acaa">18</span><span class="token style language-css unit">px</span><span class="token style language-css">/</span><span class="token style language-css number" style="color:#36acaa">1.5</span><span class="token style language-css"> system-ui</span><span class="token style language-css punctuation" style="color:#393A34">,</span><span class="token style language-css"> sans-serif</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"> </span><span class="token style language-css punctuation" style="color:#393A34">}</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">    </span><span class="token style language-css selector class" style="color:#00009f">.walk</span><span class="token style language-css"> </span><span class="token style language-css punctuation" style="color:#393A34">{</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">      </span><span class="token style language-css property" style="color:#36acaa">box-sizing</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> border-box</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">      </span><span class="token style language-css property" style="color:#36acaa">width</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css number" style="color:#36acaa">720</span><span class="token style language-css unit">px</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">      </span><span class="token style language-css property" style="color:#36acaa">padding</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css number" style="color:#36acaa">24</span><span class="token style language-css unit">px</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">      </span><span class="token style language-css property" style="color:#36acaa">color</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css hexcode color">#173c32</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">      </span><span class="token style language-css property" style="color:#36acaa">background</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css hexcode color">#e5f2e8</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">    </span><span class="token style language-css punctuation" style="color:#393A34">}</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">    </span><span class="token style language-css selector class" style="color:#00009f">.distance</span><span class="token style language-css"> </span><span class="token style language-css punctuation" style="color:#393A34">{</span><span class="token style language-css"> </span><span class="token style language-css property" style="color:#36acaa">float</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> right</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"> </span><span class="token style language-css punctuation" style="color:#393A34">}</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">  </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">style</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">head</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">body</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">main</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">class</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">walk</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">strong</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">class</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">distance</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">2 miles</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">strong</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Woodland loop</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">p</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Start at the old oak and follow the green signs.</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">p</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">main</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">body</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">html</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<table><thead><tr><th>Viewport preset</th><th>What you should see</th></tr></thead><tbody><tr><td>Desktop, 1280 pixels</td><td>The full green card and some white space to its right.</td></tr><tr><td>Tablet, 768 pixels</td><td>The full card, with a much smaller gap on the right.</td></tr><tr><td>Mobile, 390 pixels</td><td>The heading is visible. You have to scroll sideways inside the preview to reach <strong>2 miles</strong>.</td></tr></tbody></table>
<a href="https://docs.phcode.dev/tutorials/media/responsive-card-mobile-overflow.png"><img src="https://docs.phcode.dev/tutorials/media/responsive-card-mobile-overflow.png" width="692" height="350" style="height:auto" loading="lazy" alt="Mobile is selected in the Phoenix HTML Viewer. The Woodland loop heading is visible, but the distance lies outside the right edge of the phone preview."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="fix-the-card-and-test-again">Fix the card and test again<a href="https://docs.phcode.dev/blog/test-website-on-different-screen-sizes#fix-the-card-and-test-again" class="hash-link" aria-label="Direct link to Fix the card and test again" title="Direct link to Fix the card and test again" translate="no">​</a></h2>
<p>In <strong>HTML source</strong>, find <code>width: 720px;</code> inside the <code>.walk</code> rule. Keep that line and add the following one immediately below it.</p>
<div class="language-css codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-css codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token property" style="color:#36acaa">max-width</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token unit">%</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>Switch back to <strong>Preview</strong> if needed. At <strong>Mobile</strong>, the distance and heading should now be visible together. The description wraps to a second line. Switch back to <strong>Tablet</strong> and <strong>Desktop</strong>. The card still stops at 720 pixels on those wider screens.</p>
<a href="https://docs.phcode.dev/tutorials/media/responsive-card-mobile-fit.png"><img src="https://docs.phcode.dev/tutorials/media/responsive-card-mobile-fit.png" width="692" height="350" style="height:auto" loading="lazy" alt="After adding max-width, the Mobile preview shows both Woodland loop and 2 miles inside the green card. The description wraps within its right edge."></a>
<p>The card needed 720 pixels even when its parent had only 390. The new maximum lets it shrink to the available width. The existing <code>box-sizing: border-box</code> keeps the padding inside that width. On your own page, apply the change to the element that sticks out, save the stylesheet, and repeat the same width checks. <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/max-width" target="_blank" rel="noopener noreferrer" class="">How CSS max-width works</a></p>
<p>For a page with a sidebar, you can also move the two columns into reading order on a phone. <a class="" href="https://docs.phcode.dev/blog/responsive-css-grid-sidebar">Build a responsive CSS Grid sidebar</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="test-a-project-with-separate-files">Test a project with separate files<a href="https://docs.phcode.dev/blog/test-website-on-different-screen-sizes#test-a-project-with-separate-files" class="hash-link" aria-label="Direct link to Test a project with separate files" title="Direct link to Test a project with separate files" translate="no">​</a></h2>
<p>If your HTML links to a local stylesheet or images, open the whole project in Phoenix Code so Live Preview can find those files. In <strong>Phoenix Pro</strong>, the device-size button at the right of the Live Preview toolbar lets you switch widths. After checking the layout, open your published page on a real phone to try the links, touch controls, and on-screen keyboard. <a class="" href="https://docs.phcode.dev/docs/Pro%20Features/device-preview">Device Preview in Phoenix Pro</a> · <a class="" href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript">Troubleshoot missing styles and images</a></p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="HTML" term="HTML"/>
        <category label="CSS" term="CSS"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Why a Unix timestamp shows 1970 in JavaScript]]></title>
        <id>https://docs.phcode.dev/blog/unix-timestamp-seconds-or-milliseconds</id>
        <link href="https://docs.phcode.dev/blog/unix-timestamp-seconds-or-milliseconds"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Compare Unix timestamps in seconds and milliseconds, fix a JavaScript date that lands in 1970, and read the same event in UTC and local time.]]></summary>
        <content type="html"><![CDATA[<p>Suppose a log says an event happened at <code>1735689600</code>. You expect January 1, 2025, but <code>new Date(1735689600)</code> gives you a date in January 1970. That log counts <strong>seconds</strong> since January 1, 1970 at midnight UTC. JavaScript expects <strong>milliseconds</strong> when you pass a number to <code>new Date()</code>.</p>
<p>There are 1,000 milliseconds in a second. You can check the units in a browser before changing any code.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="check-the-same-instant-two-ways">Check the same instant two ways<a href="https://docs.phcode.dev/blog/unix-timestamp-seconds-or-milliseconds#check-the-same-instant-two-ways" class="hash-link" aria-label="Direct link to Check the same instant two ways" title="Direct link to Check the same instant two ways" translate="no">​</a></h2>
<p>Open the <a href="https://phcode.dev/tools/unix-timestamp-converter.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Code Unix Timestamp Converter</a>. Under <strong>Timestamp to Date</strong>, enter each number in turn, click <strong>Convert</strong>, and look at <strong>ISO 8601</strong> in the result. The final <code>Z</code> means the time is in UTC.</p>
<table><thead><tr><th>Number you enter</th><th>Units in this example</th><th>ISO 8601 result</th></tr></thead><tbody><tr><td><code>1735689600</code></td><td>Seconds</td><td><code>2025-01-01T00:00:00.000Z</code></td></tr><tr><td><code>1735689600000</code></td><td>Milliseconds</td><td><code>2025-01-01T00:00:00.000Z</code></td></tr><tr><td><code>1735689600123</code></td><td>Milliseconds, 123 ms after midnight</td><td><code>2025-01-01T00:00:00.123Z</code></td></tr></tbody></table>
<p>The first two numbers identify the same instant. For a value from your own system, check the field description for <strong>seconds</strong> or <strong>milliseconds</strong>. A number’s length is a clue for recent dates. The documented units also work for older dates and values close to zero.</p>
<a href="https://docs.phcode.dev/tutorials/media/unix-seconds-milliseconds.png"><img src="https://docs.phcode.dev/tutorials/media/unix-seconds-milliseconds.png" width="1052" height="427" style="height:auto" loading="lazy" alt="The converter shows 1735689600123 as January 1, 2025 in UTC and December 31, 2024 at 7 p.m. in New York. Its ISO result preserves .123 seconds."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="pass-milliseconds-to-javascript">Pass milliseconds to JavaScript<a href="https://docs.phcode.dev/blog/unix-timestamp-seconds-or-milliseconds#pass-milliseconds-to-javascript" class="hash-link" aria-label="Direct link to Pass milliseconds to JavaScript" title="Direct link to Pass milliseconds to JavaScript" translate="no">​</a></h2>
<p>If the field contains seconds, multiply by 1,000 once. If the field already contains milliseconds, pass the number through directly. Try these lines in a browser console or your JavaScript file. <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date" target="_blank" rel="noopener noreferrer" class="">JavaScript Date constructor</a>.</p>
<div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> logSeconds </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1735689600</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> logMilliseconds </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1735689600123</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">logSeconds</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">toISOString</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain">        </span><span class="token comment" style="color:#999988;font-style:italic">// 1970-01-21T02:08:09.600Z</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">logSeconds </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1000</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">toISOString</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// 2025-01-01T00:00:00.000Z</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">logMilliseconds</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">toISOString</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain">   </span><span class="token comment" style="color:#999988;font-style:italic">// 2025-01-01T00:00:00.123Z</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="why-local-time-can-show-the-previous-day">Why local time can show the previous day<a href="https://docs.phcode.dev/blog/unix-timestamp-seconds-or-milliseconds#why-local-time-can-show-the-previous-day" class="hash-link" aria-label="Direct link to Why local time can show the previous day" title="Direct link to Why local time can show the previous day" translate="no">​</a></h2>
<p>For the first example, <strong>UTC</strong> shows midnight on January 1. With the browser set to New York, <strong>Local Time</strong> shows 7 p.m. on December 31. New York was five hours behind UTC at that instant. Your local result depends on your time zone. When comparing events from two machines, compare their ISO values including the <code>Z</code> and any fractional seconds.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="JavaScript" term="JavaScript"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Convert WebP to JPG and Choose the Background Color]]></title>
        <id>https://docs.phcode.dev/blog/convert-webp-to-jpg-background</id>
        <link href="https://docs.phcode.dev/blog/convert-webp-to-jpg-background"/>
        <updated>2026-11-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Convert a transparent WebP to a JPG with a white or custom background. Compare two actual downloads and see when to keep a transparent PNG instead.]]></summary>
        <content type="html"><![CDATA[<p>A logo can float over any page color as a transparent WebP. A JPG needs a color in every pixel. If an upload form requires JPG, choose the background <strong>before adding the file</strong>. These two images came from the same WebP. Only the background setting changed.</p>
<table><thead><tr><th>White background</th><th>Dark green background</th></tr></thead><tbody><tr><td><img src="https://docs.phcode.dev/tutorials/trail-marker/marker-white.jpg" width="240" height="160" style="height:auto" alt="The orange trail marker on a white rectangular background."></td><td><img src="https://docs.phcode.dev/tutorials/trail-marker/marker-dark.jpg" width="240" height="160" style="height:auto" alt="The same orange trail marker on a dark green rectangular background."></td></tr></tbody></table>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="download-a-jpg-with-the-background-you-want">Download a JPG with the background you want<a href="https://docs.phcode.dev/blog/convert-webp-to-jpg-background#download-a-jpg-with-the-background-you-want" class="hash-link" aria-label="Direct link to Download a JPG with the background you want" title="Direct link to Download a JPG with the background you want" translate="no">​</a></h2>
<ol>
<li class="">Open the <a href="https://phcode.dev/tools/webp-to-jpg.html" target="_blank" rel="noopener noreferrer" class="">Phoenix WebP to JPG Converter</a>. Use your own WebP, or download the <a href="https://docs.phcode.dev/tutorials/trail-marker/trail-marker.webp" download="trail-marker.webp">transparent trail marker</a> to follow along.</li>
<li class="">Leave <strong>Image quality</strong> at <strong>90%</strong> for this example. Under <strong>Background color</strong>, keep white (<code>#FFFFFF</code>) for the first result, or click the color swatch and choose the color you want behind the image. We used dark green (<code>#21392F</code>) for the second version.</li>
<li class="">Click <strong>Choose files</strong> and select the WebP. Conversion starts when you select it. In <strong>Your JPG files</strong>, use the download button on the row for your image.</li>
<li class="">Open the downloaded <code>trail-marker.jpg</code>. The marker still measures <strong>240 × 160 pixels</strong>. Look at the four corners to see the chosen background. If you want another version, set the new color and add the original WebP again.</li>
</ol>
<a href="https://docs.phcode.dev/tutorials/media/webp-jpg-download.png"><img src="https://docs.phcode.dev/tutorials/media/webp-jpg-download.png" width="1092" height="300" style="height:auto" loading="lazy" alt="The converted trail-marker.jpg is ready under Your JPG files, with its download control beside the file."></a>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="why-does-the-white-box-stay">Why does the white box stay?<a href="https://docs.phcode.dev/blog/convert-webp-to-jpg-background#why-does-the-white-box-stay" class="hash-link" aria-label="Direct link to Why does the white box stay?" title="Direct link to Why does the white box stay?" translate="no">​</a></h2>
<p>Check which file you added. If you start the second conversion with the <strong>white JPG</strong>, the white corners are already part of the picture. Go back to the original transparent WebP. The background setting fills transparent pixels. It leaves an opaque white area in a photo or logo in place.</p>
<p>The quality slider controls JPG compression. Increasing it won’t restore transparency, and decreasing it can soften the sharp edges of lettering. Compare the downloaded file at the size visitors will see it. <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats/Image_types" target="_blank" rel="noopener noreferrer" class="">Image formats and transparency</a></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="keep-the-transparent-corners">Keep the transparent corners<a href="https://docs.phcode.dev/blog/convert-webp-to-jpg-background#keep-the-transparent-corners" class="hash-link" aria-label="Direct link to Keep the transparent corners" title="Direct link to Keep the transparent corners" translate="no">​</a></h2>
<p>If the same logo must sit on both light and dark pages, keep the original WebP or open it in the <a href="https://phcode.dev/tools/webp-to-png.html" target="_blank" rel="noopener noreferrer" class="">Phoenix WebP to PNG Converter</a>. Choose the original file and download the PNG. In our practice export, the corner pixel stayed fully transparent. You can check your own file by sampling a corner in the <a class="" href="https://docs.phcode.dev/blog/get-hex-color-from-image#pick-one-pixel-from-the-picture">image color picker walkthrough</a>.</p>]]></content>
        <author>
            <name>Charly Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="Images" term="Images"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Why Your HTML Preview Is Missing CSS, Images or JavaScript]]></title>
        <id>https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript</id>
        <link href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript"/>
        <updated>2026-11-19T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Fix CSS not loading, missing images and JavaScript that won't run in an HTML preview. Check file paths and permissions with working examples.]]></summary>
        <content type="html"><![CDATA[<p>An HTML file can link to CSS, images, and JavaScript without copying those files
into it. If a preview is missing styles or images, first check the file paths and
the preview permissions. If a button does nothing, check whether scripts are allowed.
This guide also helps when CSS is not loading, HTML images are not showing, or
JavaScript is not working in HTML.</p>
<p>The examples below use <a href="https://phcode.dev/tools/html-viewer.html" target="_blank" rel="noopener noreferrer" class="">Phoenix HTML Viewer</a>.
HTML and CSS written inside the document work by default. Hosted files and
JavaScript each need permission in the Viewer. The Viewer reads the HTML file you open;
it does not import the files beside it.</p>
<p><strong>You will need:</strong> your HTML text or an <code>.html</code> file. The Viewer is free and runs
in your browser. For the last steps, keep any separate CSS, JavaScript, and image
files with your HTML. You can use file editing and Live Preview. These features
are in both Phoenix Pro and the free Community edition.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="identify-what-is-missing">Identify what is missing<a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#identify-what-is-missing" class="hash-link" aria-label="Direct link to Identify what is missing" title="Direct link to Identify what is missing" translate="no">​</a></h2>
<table><thead><tr><th>What you see</th><th>First check</th><th>Next step</th></tr></thead><tbody><tr><td>Hosted CSS is not loading</td><td>Is external access enabled?</td><td>For trusted content, turn on <strong>Allow external resources</strong>. Then <a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#distinguish-hosted-addresses-from-relative-paths" class="">try the hosted example</a>.</td></tr><tr><td>A local <code>styles.css</code> file is not loading</td><td>Did you open only the HTML file?</td><td><a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#open-the-complete-project-in-phoenix-code" class="">Open the full project folder</a> in Phoenix Code.</td></tr><tr><td>An image is not showing</td><td>Is its address a hosted URL or a local path?</td><td><a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#keep-local-files-in-the-expected-folders" class="">Check the path and filename</a>.</td></tr><tr><td>A hosted file still does not load</td><td>What URL did the browser request?</td><td><a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#check-a-failed-resource" class="">Check the failed request</a>.</td></tr><tr><td>A button does nothing</td><td>Is JavaScript allowed?</td><td><a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#check-a-small-javascript-interaction" class="">Test a small inline script</a> before you debug a bigger one.</td></tr></tbody></table>
<p>If the stylesheet loads but the page still looks wrong, check whether the CSS
rule targets the right element or another rule overrides it. For a heading that
stays in capitals, <a class="" href="https://docs.phcode.dev/blog/change-all-caps-website-text#when-the-html-looks-right-but-the-page-is-still-uppercase">compare the HTML text with its CSS text-transform rule</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="check-a-self-contained-html-example">Test HTML and inline CSS<a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#check-a-self-contained-html-example" class="hash-link" aria-label="Direct link to Test HTML and inline CSS" title="Direct link to Test HTML and inline CSS" translate="no">​</a></h2>
<ol>
<li class="">Open the <a href="https://phcode.dev/tools/html-viewer.html" target="_blank" rel="noopener noreferrer" class="">HTML Viewer</a>.</li>
<li class="">Click inside <strong>HTML source</strong> and paste the complete document below, replacing
any sample text already there. It needs no downloaded stylesheet, image, or
JavaScript.</li>
</ol>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token doctype punctuation" style="color:#393A34;font-style:italic">&lt;!</span><span class="token doctype doctype-tag" style="color:#999988;font-style:italic">doctype</span><span class="token doctype" style="color:#999988;font-style:italic"> </span><span class="token doctype name" style="color:#999988;font-style:italic">html</span><span class="token doctype punctuation" style="color:#393A34;font-style:italic">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">html</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">lang</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">en</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">head</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">meta</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">charset</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">utf-8</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">meta</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">name</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">viewport</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">content</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">width=device-width, initial-scale=1</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">title</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Preview check</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">title</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">style</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">    </span><span class="token style language-css selector" style="color:#00009f">body</span><span class="token style language-css"> </span><span class="token style language-css punctuation" style="color:#393A34">{</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">      </span><span class="token style language-css property" style="color:#36acaa">background</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css hexcode color">#f4f6f8</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">      </span><span class="token style language-css property" style="color:#36acaa">padding</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css number" style="color:#36acaa">24</span><span class="token style language-css unit">px</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">    </span><span class="token style language-css punctuation" style="color:#393A34">}</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">    </span><span class="token style language-css selector" style="color:#00009f">p</span><span class="token style language-css"> </span><span class="token style language-css punctuation" style="color:#393A34">{</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">      </span><span class="token style language-css property" style="color:#36acaa">color</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css hexcode color">#164ea6</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">      </span><span class="token style language-css property" style="color:#36acaa">font-size</span><span class="token style language-css punctuation" style="color:#393A34">:</span><span class="token style language-css"> </span><span class="token style language-css number" style="color:#36acaa">20</span><span class="token style language-css unit">px</span><span class="token style language-css punctuation" style="color:#393A34">;</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">    </span><span class="token style language-css punctuation" style="color:#393A34">}</span><span class="token style language-css"></span><br></div><div class="token-line" style="color:#393A34"><span class="token style language-css">  </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">style</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">head</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">body</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">p</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">HTML and inline CSS are working.</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">p</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">body</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">html</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<ol start="3">
<li class="">Look at the <strong>Rendered preview</strong> panel. On a narrow screen, switch from <strong>Source</strong> to
<strong>Preview</strong> to see the result.</li>
</ol>
<p>You should see a blue paragraph on a pale background.</p>
<figure class="html-preview-figure"><a href="https://docs.phcode.dev/tutorials/media/html-preview-inline-result.png"><img src="https://docs.phcode.dev/tutorials/media/html-preview-inline-result.png" width="1250" height="670" loading="lazy" alt="HTML Viewer showing the example's blue paragraph on a pale background, with Allow external resources unchecked."></a><figcaption>The complete example works with external resources off. Select the image to inspect the source and preview it at full size.</figcaption></figure>
<p>If this works, add parts of your original page a little at a time: HTML first,
then styles, images, and scripts. When the preview breaks, check the last part
you added.</p>
<p>To check your own file, choose <strong>Open .html file</strong> above the source editor. This
replaces the current source. To keep your edits, use <strong>Download .html</strong> in the
source toolbar first. On desktop, this is the download-arrow button with that tooltip.</p>
<p>To see a saved page with the CSS and images beside it on your computer, <a class="" href="https://docs.phcode.dev/blog/open-an-html-file-in-chrome">open the local HTML file in Chrome</a>.</p>
<p>If changes stop appearing, check whether <strong>Live preview</strong> is on. Its checkbox
and <strong>Allow external resources</strong> are above the editor on a wide screen. On a
narrow screen, open <strong>Preview settings</strong> below the workspace. When <strong>Live
preview</strong> is off, use <strong>Refresh preview</strong> after you edit.</p>
<figure class="html-preview-figure html-preview-mobile-figure"><a href="https://docs.phcode.dev/tutorials/media/html-preview-mobile-settings.png"><img src="https://docs.phcode.dev/tutorials/media/html-preview-mobile-settings.png" width="322" height="278" loading="lazy" alt="Expanded mobile Preview settings showing Live preview and Allow external resources checked, with Run scripts unchecked."></a><figcaption>On mobile, open <strong>Preview settings</strong>. There, external resources are on and scripts stay off.</figcaption></figure>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="keep-local-files-in-the-expected-folders">Keep local files in the expected folders<a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#keep-local-files-in-the-expected-folders" class="hash-link" aria-label="Direct link to Keep local files in the expected folders" title="Direct link to Keep local files in the expected folders" translate="no">​</a></h2>
<p>For a working example, download the <a href="https://docs.phcode.dev/assets/files/image-text-layout-fd65c00fc667809e210d1f29dc8a33ea.zip" target="_blank" class="">image-and-text practice project</a>
used in our <a class="" href="https://docs.phcode.dev/docs/tutorials/image-text-layout">image layout tutorial</a>. Extract the
ZIP first. Keep these files together in the extracted folder:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">image-text-layout/</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">├── index.html</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">├── styles.css</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">└── images/</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    └── woodland.jpg</span><br></div></code></pre></div></div>
<p>Inside <code>index.html</code>, a stylesheet reference belongs in the <code>head</code>:</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">link</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">rel</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">stylesheet</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">styles.css</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>An image reference belongs where the image should appear in the body:</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">img</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">src</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">images/woodland.jpg</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">alt</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">A sunlit path between tall trees</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">  </span><span class="token tag attr-name" style="color:#00a4db">width</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">1200</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">height</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">675</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>The first path expects <code>styles.css</code> beside the HTML file. The second expects
<code>woodland.jpg</code> inside an <code>images</code> folder. Check that the
filenames and case match the files you have. For your own project,
use your image's filename, dimensions, and description.</p>
<p>Opening only <code>index.html</code> in the Viewer leaves those files behind.
<strong>Allow external resources</strong> cannot give the Viewer access to other files on
your computer. Keep the files together and use
the <a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#open-the-complete-project-in-phoenix-code" class="">full-project workflow below</a>.</p>
<p>If the missing image is the small icon in the browser tab, follow <a class="" href="https://docs.phcode.dev/blog/how-to-add-a-favicon-in-html">Add a favicon in HTML</a> to check it on both the home page and a nested page.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="distinguish-hosted-addresses-from-relative-paths">Check hosted URLs and relative paths<a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#distinguish-hosted-addresses-from-relative-paths" class="hash-link" aria-label="Direct link to Check hosted URLs and relative paths" title="Direct link to Check hosted URLs and relative paths" translate="no">​</a></h2>
<p>A full URL such as <code>https://example.com/images/logo.png</code> points to a file on a
website. This is an example URL; replace it with your own image URL when testing.
Hosted images, stylesheets, and fonts need <strong>Allow external resources</strong> in the Viewer.</p>
<p>An image address that starts with <code>data:image/</code> carries the image inside the HTML. If that image is missing, <a class="" href="https://docs.phcode.dev/blog/decode-base64-text-and-images#see-an-image-copied-from-html">test the complete data URL with a working Base64 image</a>.</p>
<p>To see the difference, replace the Viewer source with this complete example.
It loads the same practice stylesheet and woodland photo from the docs website:</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token doctype punctuation" style="color:#393A34;font-style:italic">&lt;!</span><span class="token doctype doctype-tag" style="color:#999988;font-style:italic">doctype</span><span class="token doctype" style="color:#999988;font-style:italic"> </span><span class="token doctype name" style="color:#999988;font-style:italic">html</span><span class="token doctype punctuation" style="color:#393A34;font-style:italic">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">html</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">lang</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">en</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">head</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">meta</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">charset</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">utf-8</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">meta</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">name</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">viewport</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">content</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">width=device-width, initial-scale=1</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">title</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Hosted resource check</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">title</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">link</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">rel</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">stylesheet</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">    </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">https://docs.phcode.dev/tutorials/image-text-layout/styles.css</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">head</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">body</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">A woodland walk</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">div</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">class</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">feature</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">img</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">      </span><span class="token tag attr-name" style="color:#00a4db">src</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">https://docs.phcode.dev/tutorials/image-text-layout/images/woodland.jpg</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"></span><br></div><div class="token-line" style="color:#393A34"><span class="token tag" style="color:#00009f">      </span><span class="token tag attr-name" style="color:#00a4db">alt</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">A sunlit path between tall trees</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">width</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">320</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">height</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">180</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">div</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">body</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">html</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<ol>
<li class="">With <strong>Allow external resources</strong> off, the heading is unstyled and the photo
does not load.</li>
<li class="">Turn on <strong>Allow external resources</strong> for this example. You should see a dark
green heading, a pale background, and the woodland photo. Leave scripts off;
this example needs only HTML, CSS, and an image.</li>
</ol>
<figure class="html-preview-figure html-preview-video"><video poster="/tutorials/media/html-preview-hosted-resources-poster.png" width="638" height="742" style="width:100%;height:auto" aria-label="Load hosted CSS and images in HTML Viewer: a silent recording of the real controls and result" controls="" muted="" playsinline="" preload="metadata"><source src="/tutorials/media/html-preview-hosted-resources.mp4" type="video/mp4"><track kind="captions" src="/tutorials/media/html-preview-hosted-resources.vtt" srclang="en" label="English"><a href="https://docs.phcode.dev/tutorials/media/html-preview-hosted-resources.mp4">Watch <!-- -->Load hosted CSS and images in HTML Viewer</a>.</video><div class="watchAction_uyiw"><a aria-label="Open video: Load hosted CSS and images in HTML Viewer" href="https://docs.phcode.dev/videos/html-viewer-hosted-resources">Open video<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M5 12h14m-6-6 6 6-6 6"></path></svg></a></div><figcaption>Someone has already pasted the example into the Viewer. The recording shows that external access is off, someone turned on the setting, and the hosted files are loading.</figcaption></figure>
<p>The photo is by <a href="https://unsplash.com/photos/pathway-of-trees-during-daytime-P1Iz3unD6Po" target="_blank" rel="noopener noreferrer" class="">Johannes Plenio on Unsplash</a>,
as credited in the practice project. This example uses complete hosted addresses;
it does not access files on your computer.</p>
<p>A relative path starts from another location. For paths in your HTML:</p>
<ul>
<li class=""><code>styles.css</code> and <code>./styles.css</code> resolve from the current directory.</li>
<li class=""><code>../styles.css</code> resolves from the parent directory.</li>
<li class="">On an HTTP or HTTPS page, the browser resolves <code>/styles.css</code> from the site
root, even when the page is in a subfolder.</li>
</ul>
<p>A relative path does not mean 'find this file anywhere on my computer.'
<a href="https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references" target="_blank" rel="noopener noreferrer" class="">MDN explains how relative references are resolved</a>.</p>
<p>For a background image in an external CSS file, a relative <code>url(...)</code> starts
from <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/url_function" target="_blank" rel="noopener noreferrer" class="">the stylesheet's location</a>,
which may be a different folder from the HTML file.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="check-a-failed-resource">If a hosted file still will not load<a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#check-a-failed-resource" class="hash-link" aria-label="Direct link to If a hosted file still will not load" title="Direct link to If a hosted file still will not load" translate="no">​</a></h3>
<p>Permission alone will not fix a wrong URL or a missing file. Open the image or
stylesheet URL in a new tab. It should show the image or CSS itself, not a sign-in screen or a sharing page.</p>
<p>To see what the preview actually requested in Chrome on desktop:</p>
<ol>
<li class="">Open Chrome's three-dot menu, then <strong>More tools &gt; Developer tools</strong>. Select
<strong>Network</strong> in the developer tools panel.</li>
<li class="">In the Viewer, turn <strong>Live preview</strong> off and click <strong>Refresh preview</strong>. Keep
<strong>Allow external resources</strong> on only for content you trust.</li>
<li class="">Find the image or CSS request in <strong>Network</strong>. Select it and open <strong>Headers</strong>
to check <strong>Request URL</strong> and <strong>Status Code</strong>.</li>
</ol>
<table><thead><tr><th>What you find</th><th>What to check</th></tr></thead><tbody><tr><td><code>404</code></td><td>The server could not find that URL. Check the filename, case, and folder path.</td></tr><tr><td>A blocked request</td><td>Read the browser's <strong>Console</strong> message for the reason. Renaming the file will not fix a preview restriction.</td></tr><tr><td><code>200</code>, but the page is still unstyled</td><td>Check that the response contains the expected CSS, then check which rules apply to the element.</td></tr></tbody></table>
<p><a href="https://developer.chrome.com/docs/devtools/network" target="_blank" rel="noopener noreferrer" class="">Chrome's Network guide</a>
explains the request details. Turn <strong>Live preview</strong> back on when you are done.
External resources can contact other websites, so leave them off for HTML you
do not trust. Do not disable browser security to make a preview work.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="check-a-small-javascript-interaction">Test a button with inline JavaScript<a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#check-a-small-javascript-interaction" class="hash-link" aria-label="Direct link to Test a button with inline JavaScript" title="Direct link to Test a button with inline JavaScript" translate="no">​</a></h2>
<p>Paste the <a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#check-a-self-contained-html-example" class="">first, self-contained example</a>
back into the Viewer. Add this button after the paragraph, just before the
closing <code>&lt;/body&gt;</code> tag. Start with <strong>Allow external resources</strong> off.</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">button</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">type</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag attr-value" style="color:#e3116c">button</span><span class="token tag attr-value punctuation" style="color:#393A34">'</span><span class="token tag" style="color:#00009f"> </span><span class="token tag special-attr attr-name" style="color:#00a4db">onclick</span><span class="token tag special-attr attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag special-attr attr-value punctuation" style="color:#393A34">'</span><span class="token tag special-attr attr-value value javascript language-javascript keyword" style="color:#00009f">this</span><span class="token tag special-attr attr-value value javascript language-javascript punctuation" style="color:#393A34">.</span><span class="token tag special-attr attr-value value javascript language-javascript property-access" style="color:#e3116c">textContent</span><span class="token tag special-attr attr-value value javascript language-javascript operator" style="color:#393A34">=</span><span class="token tag special-attr attr-value value javascript language-javascript template-string template-punctuation string" style="color:#e3116c">`</span><span class="token tag special-attr attr-value value javascript language-javascript template-string string" style="color:#e3116c">Clicked</span><span class="token tag special-attr attr-value value javascript language-javascript template-string template-punctuation string" style="color:#e3116c">`</span><span class="token tag special-attr attr-value punctuation" style="color:#393A34">'</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  Test button</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">button</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>With scripts off, the button appears, but clicking it does not change its label.
Turn on <strong>Allow external resources</strong>, then select <strong>Run scripts —
enable external resources first</strong>. Click the <strong>Test button</strong> in the preview again;
its label should change to <strong>Clicked</strong>.</p>
<figure class="html-preview-figure html-preview-video"><video poster="/tutorials/media/html-preview-inline-javascript-poster.png" width="638" height="742" style="width:100%;height:auto" aria-label="Test inline JavaScript in HTML Viewer: a silent recording of the real controls and result" controls="" muted="" playsinline="" preload="metadata"><source src="/tutorials/media/html-preview-inline-javascript.mp4" type="video/mp4"><track kind="captions" src="/tutorials/media/html-preview-inline-javascript.vtt" srclang="en" label="English"><a href="https://docs.phcode.dev/tutorials/media/html-preview-inline-javascript.mp4">Watch <!-- -->Test inline JavaScript in HTML Viewer</a>.</video><div class="watchAction_uyiw"><a aria-label="Open video: Test inline JavaScript in HTML Viewer" href="https://docs.phcode.dev/videos/html-viewer-inline-javascript">Open video<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M5 12h14m-6-6 6 6-6 6"></path></svg></a></div><figcaption>The button is already in the source. Its first click does nothing. After you enable both settings, click it again and the label changes to <strong>Clicked</strong>.</figcaption></figure>
<p>Changing these permission settings refreshes the preview and resets the button.
Click it again after you change a setting.</p>
<p>This tests JavaScript written inside the HTML. In pasted HTML, the Viewer can
run inline scripts, but it blocks external <code>&lt;script src&gt;</code> files and <code>fetch</code>/XHR
requests.</p>
<p>To test a small example with a separate stylesheet or script, open the
<a href="https://phcode.dev/tools/html-editor.html" target="_blank" rel="noopener noreferrer" class="">online HTML editor</a>. Paste your HTML,
CSS and JavaScript into the <code>index.html</code>, <code>style.css</code> and <code>script.js</code> tabs.</p>
<p>For a project with more files or modules, open the full folder in an editor.
If it also needs a backend server, run that server too.</p>
<p>If your own inline script still fails, open the developer tools <strong>Console</strong>.
Fix the first error from your script, then test again.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="open-the-complete-project-in-phoenix-code">Open the complete project in Phoenix Code<a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#open-the-complete-project-in-phoenix-code" class="hash-link" aria-label="Direct link to Open the complete project in Phoenix Code" title="Direct link to Open the complete project in Phoenix Code" translate="no">​</a></h2>
<p>For a complete editing workspace, use <a href="https://phcode.dev/" target="_blank" rel="noopener noreferrer" class="">Phoenix Code</a>.
Work on your HTML, CSS and JavaScript files together, with Live Preview alongside
your code.</p>
<p>For HTML that links to local CSS, images, or scripts, use
<a class="" href="https://docs.phcode.dev/docs/quick-start-project#open-folder">Phoenix Code's project workflow</a>.
Follow the extracted practice project above. Open its original
<code>index.html</code>, which uses local paths. The hosted example above was only for
testing resource permissions.</p>
<p>For your own project:</p>
<ol>
<li class="">If you edited the document in the Viewer, use <strong>Download .html</strong> to save it.
This downloads the HTML source; it does not collect referenced images or
stylesheets.</li>
<li class="">Keep that HTML file with its CSS, JavaScript, and images in the folders its
paths point to.</li>
<li class="">Open <a href="https://phcode.dev/" target="_blank" rel="noopener noreferrer" class="">Phoenix Code</a> on desktop, or use <a href="https://web.phcode.dev/" target="_blank" rel="noopener noreferrer" class="">its browser app</a>
in Chrome or Edge for local-folder access.</li>
<li class="">In the <strong>Start Project Dialog</strong>, choose <strong>Open Folder</strong> and select the folder
containing the HTML file. If the dialog is closed, click the folder icon at
the top left to open it again. The project files should appear in the file list.</li>
<li class="">Click your HTML file in the file list. If the preview is hidden, click the
<span data-tutorial-icon-label="preview"><span class="firstWord_vfhG"><svg viewBox="-8.5 7.5 24 24" fill="currentColor" class="icon_qpoT" aria-hidden="true" focusable="false" data-tutorial-icon="preview" data-tutorial-icon-src="/img/tutorial-icons/preview.svg"><polygon points="6.5 18.5 .5 14.5 -7.5 24.5 .5 19.5 6.5 23.5 14.5 13.5" transform="translate(0 1)"></polygon></svg> <strong>lightning</strong></span><strong> bolt</strong></span> at the top of the right
toolbar to show <a class="" href="https://docs.phcode.dev/docs/Features/Live%20Preview">Live Preview</a>.</li>
<li class="">If Phoenix Code asks whether you trust the project, choose <strong>Trust &amp; Execute
Preview</strong> only for a project you trust.</li>
<li class="">Fix any incorrect paths in the HTML and use <strong>File &gt; Save File</strong>. In Live
Preview, check that the stylesheet changes the page and the
image loads.</li>
</ol>
<p>The Viewer link does not transfer your project. Save your edited HTML in its
project folder, then open that folder in Phoenix Code.</p>
<p>In the practice project, opening <code>index.html</code> should show <strong>Plan a woodland walk</strong>,
the forest photo, and <strong>Take the scenic route</strong>. To arrange that photo beside its
text, continue with the <a class="" href="https://docs.phcode.dev/docs/tutorials/image-text-layout">image-and-text layout tutorial</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="qa">Q&amp;A<a href="https://docs.phcode.dev/blog/html-preview-missing-css-images-javascript#qa" class="hash-link" aria-label="Direct link to Q&amp;A" title="Direct link to Q&amp;A" translate="no">​</a></h2>
<p><strong>Question:</strong> Why does inline CSS work in the HTML Viewer, but my separate styles.css file does not?</p>
<p><strong>Short answer:</strong> Inline CSS is part of the HTML document you paste or open, so the Viewer can render it right away. A separate local styles.css file is not loaded when you open only the HTML file. If your page uses local CSS, images, or JavaScript files, keep them in the right folders. Open the full project folder in Phoenix Code instead of just opening the HTML file in the Viewer.</p>
<p><strong>Question:</strong> Does <strong>Allow external resources</strong> make local files on my computer available to the preview?</p>
<p><strong>Short answer:</strong> No. <strong>Allow external resources</strong> lets the Viewer load hosted resources from websites, such as full image or stylesheet URLs. It does not give the Viewer access to other files beside your HTML on your computer. For local files like styles.css or images/woodland.jpg, use the full-project workflow and open the folder that contains all related files.</p>
<p><strong>Question:</strong> What should I check first when an image does not appear?</p>
<p><strong>Short answer:</strong> First check whether the image uses a hosted URL or a local relative path. For hosted images, make sure <strong>Allow external resources</strong> is enabled and that the URL opens the actual image, not a sign-in page or a sharing page. For local images, make sure the filename, case, and folder path match exactly. Remember, a relative path does not search your entire computer.</p>
<p><strong>Question:</strong> Why does my button show up but not respond when clicked?</p>
<p><strong>Short answer:</strong> The button may rely on JavaScript, and scripts are off by default in the Viewer. For trusted content, enable <strong>Allow external resources</strong> first, then enable <strong>Run scripts — enable external resources first</strong>. If inline JavaScript still fails, open the browser developer tools <strong>Console</strong>, fix the first script error shown there, and test again.</p>
<p><strong>Question:</strong> When should I switch from the HTML Viewer to Phoenix Code?</p>
<p><strong>Short answer:</strong> Use the HTML Viewer for quick checks with pasted HTML, inline CSS, hosted resources, or small inline JavaScript tests. Use Phoenix Code when your page needs local CSS, images, JavaScript files, modules, or a full folder structure. Phoenix Code's project workflow lets Live Preview resolve local paths from the project folder.</p>]]></content>
        <author>
            <name>Charly P Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="HTML" term="HTML"/>
        <category label="CSS" term="CSS"/>
        <category label="JavaScript" term="JavaScript"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How to Convert PNG to PDF for Free Online]]></title>
        <id>https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online</id>
        <link href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online"/>
        <updated>2026-11-08T00:30:00.000Z</updated>
        <summary type="html"><![CDATA[Combine PNG images into one PDF in your browser. Arrange pages, choose paper settings and download without uploading your images or creating an account.]]></summary>
        <content type="html"><![CDATA[<span class="png-pdf-guide-marker" hidden=""></span>
<p>You can turn a PNG screenshot, scanned page or diagram into a PDF without installing software. The <a href="https://phcode.dev/tools/png-to-pdf.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Code PNG to PDF converter</a> combines still PNG images into one file, with one image per page. Conversion runs locally in your browser, and the downloaded PDF has no watermark. No account or subscription is required.</p>
<p>This guide walks through choosing images, arranging pages and saving the result. For color, resolution and printing details, see <a class="" href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality">what PNG-to-PDF conversion preserves</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="watch-a-complete-conversion">Watch a complete conversion<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online#watch-a-complete-conversion" class="hash-link" aria-label="Direct link to Watch a complete conversion" title="Direct link to Watch a complete conversion" translate="no">​</a></h2>
<p>Follow along with <strong>Try an example</strong> in the converter. This walkthrough drags the parrot above the coastal picture, chooses <strong>A4</strong> with <strong>10 mm</strong> margins, and opens the downloaded PDF in Chrome's PDF viewer. Select <strong>Choose PNG files</strong> when you are ready to use your own images.</p>
<video poster="/tutorials/media/png-to-pdf-convert-poster.png" width="1000" height="860" style="width:100%;height:auto" aria-label="PNG to PDF walkthrough: load sample images, drag to reorder pages, choose A4 and download the PDF" controls="" muted="" playsinline="" preload="metadata"><source src="/tutorials/media/png-to-pdf-convert.mp4" type="video/mp4"><track kind="captions" src="/tutorials/media/png-to-pdf-convert.vtt" srclang="en" label="English"><a href="https://docs.phcode.dev/tutorials/media/png-to-pdf-convert.mp4">Watch <!-- -->Convert PNG images to one PDF</a>.</video><div class="watchAction_uyiw"><a aria-label="Open video: Convert PNG images to one PDF" href="https://docs.phcode.dev/videos/convert-png-to-pdf">Open video<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M5 12h14m-6-6 6 6-6 6"></path></svg></a></div>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="1-choose-your-png-images">1. Choose your PNG images<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online#1-choose-your-png-images" class="hash-link" aria-label="Direct link to 1. Choose your PNG images" title="Direct link to 1. Choose your PNG images" translate="no">​</a></h2>
<p>Open the <a href="https://phcode.dev/tools/png-to-pdf.html" target="_blank" rel="noopener noreferrer" class="">PNG to PDF converter</a>, select <strong>Choose PNG files</strong>, and pick one or more still PNG images from your device. On a computer, you can also drop PNG files into the converter or paste PNG images from the clipboard.</p>
<p>On a phone, use the file picker to choose your images. If your phone saved a photo in another format, first obtain a PNG version: this converter does not accept every image format, and renaming a file's extension does not convert it.</p>
<p>The tool checks each image before it can be included. If a file has an error, read its message and remove or replace it. Every remaining image must be ready before <strong>Create PDF</strong> becomes available.</p>
<p>Damaged or unsupported color information, including unsupported HDR data, produces a specific error. Export a copy as a standard sRGB PNG and try again, keeping your original file.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="2-put-the-pages-in-order">2. Put the pages in order<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online#2-put-the-pages-in-order" class="hash-link" aria-label="Direct link to 2. Put the pages in order" title="Direct link to 2. Put the pages in order" translate="no">​</a></h2>
<p>Each image becomes one PDF page. The order of the cards is the order of the pages in the finished file.</p>
<ul>
<li class="">With a mouse, drag from the image preview, filename or empty space on a card.</li>
<li class="">On a touch screen, press and hold a card briefly, then drag it. A normal swipe still scrolls the page.</li>
<li class="">Use <strong>Move up</strong> and <strong>Move down</strong> when you prefer buttons.</li>
<li class="">With a keyboard, focus a card and press Enter or Space. Choose its position with the arrow keys, Home or End, then press Enter or Space again. Escape cancels the move.</li>
</ul>
<p>The card's action buttons retain their own actions. You can remove an unwanted image without restarting the whole batch.</p>
<figure class="png-pdf-figure"><a href="https://docs.phcode.dev/tutorials/media/png-to-pdf-page-order.png" aria-label="Open full-size screenshot of the page order controls"><img src="https://docs.phcode.dev/tutorials/media/png-to-pdf-page-order.png" width="1088" height="691" loading="lazy" decoding="async" alt="Two sample PNGs appear as Page 1 and Page 2, each with Move up, Move down and Remove buttons."></a><figcaption>Drag the second card above the first to change the page order. Start from its preview, filename, or empty space; the buttons are separate actions.</figcaption></figure>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="3-choose-paper-and-background-settings">3. Choose paper and background settings<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online#3-choose-paper-and-background-settings" class="hash-link" aria-label="Direct link to 3. Choose paper and background settings" title="Direct link to 3. Choose paper and background settings" translate="no">​</a></h2>
<p>The settings affect every page, with automatic orientation determined separately for each image when a paper size is selected.</p>
<table><thead><tr><th>Setting</th><th>What to choose</th></tr></thead><tbody><tr><td>Page size</td><td><strong>Fit to image</strong> for a page based on each image's dimensions and stored print resolution; <strong>A4</strong> or <strong>US Letter</strong> for standard paper.</td></tr><tr><td>Orientation</td><td>With A4 or US Letter, choose <strong>Automatic</strong>, <strong>Portrait</strong> or <strong>Landscape</strong>. Fit to image determines the page shape from the image.</td></tr><tr><td>Margins</td><td>Choose none, 5 mm, 10 mm or 20 mm. Images fit inside the available area without cropping or stretching.</td></tr><tr><td>Transparent areas</td><td>Choose <strong>White</strong> to give transparent image areas a white background, or <strong>Transparent</strong> to retain transparency.</td></tr></tbody></table>
<p>Fit to image uses the PNG's stored print resolution and adds the selected margins. If no resolution is stored, it uses 96 pixels per inch. For example, a 2400-pixel-wide PNG stored at 300 pixels per inch occupies 8 inches before margins. A4 and US Letter fit the image to the chosen paper, changing its printed size while keeping the original pixel dimensions.</p>
<p>Stored image orientation and pixel aspect ratios are respected. If the stored resolution would make an image-sized PDF page too large or too small, choose A4 or US Letter and create the PDF again.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="4-check-the-layout-create-the-pdf-and-save-it">4. Check the layout, create the PDF and save it<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online#4-check-the-layout-create-the-pdf-and-save-it" class="hash-link" aria-label="Direct link to 4. Check the layout, create the PDF and save it" title="Direct link to 4. Check the layout, create the PDF and save it" translate="no">​</a></h2>
<p>The page previews show orientation, margins and image placement. They use smaller preview images, so use them to check the layout rather than fine detail or final color.</p>
<p>Select <strong>Create PDF</strong> and keep the browser tab open while it works. When the PDF is ready, select <strong>Download PDF</strong> to save it to your device. Open that downloaded file to check page order, readability and appearance before printing or sharing it.</p>
<p>Each picture is a separate page; your PDF viewer may show the pages one below another. If you keep <strong>Fit to image</strong>, the pages follow your images' dimensions instead of the A4 paper shown in the video.</p>
<p>Changing the page order or settings after creation requires creating the PDF again. Your original PNG files stay on your device.</p>
<figure class="png-pdf-figure"><a href="https://docs.phcode.dev/tutorials/media/png-to-pdf-download-ready.png" aria-label="Open full-size screenshot of the finished conversion"><img src="https://docs.phcode.dev/tutorials/media/png-to-pdf-download-ready.png" width="1088" height="691" loading="lazy" decoding="async" alt="The parrot is now Page 1 and the coastal picture is Page 2. A4 and 10 mm margins are selected, and Download PDF is available."></a><figcaption>After Create PDF finishes, Download PDF saves the result. Open the saved file to check both pages.</figcaption></figure>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="how-many-images-can-you-combine">How many images can you combine?<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online#how-many-images-can-you-combine" class="hash-link" aria-label="Direct link to How many images can you combine?" title="Direct link to How many images can you combine?" translate="no">​</a></h2>
<p>All of these limits apply together:</p>
<table><thead><tr><th>Limit</th><th>Maximum</th></tr></thead><tbody><tr><td>Images</td><td>100 still PNG files</td></tr><tr><td>Individual file</td><td>50 MB</td></tr><tr><td>Total input files</td><td>200 MB</td></tr><tr><td>Pixels in one image</td><td>24 megapixels</td></tr><tr><td>Pixels across the batch</td><td>48 megapixels</td></tr><tr><td>Either image dimension</td><td>16,384 pixels</td></tr><tr><td>Finished PDF</td><td>128 MB</td></tr></tbody></table>
<p>A batch of large scans may reach the pixel or output limit before it reaches 100 images. Available device memory can also limit a conversion. If a batch fails, try fewer or smaller images and keep the tab open.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-happens-to-your-files">What happens to your files?<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online#what-happens-to-your-files" class="hash-link" aria-label="Direct link to What happens to your files?" title="Direct link to What happens to your files?" translate="no">​</a></h2>
<p>The tool uses browser memory to process the images and generate the PDF. It does not upload your images or PDF to a conversion server or save them in persistent browser storage. The page still loads website code and other assets.</p>
<p>Your original PNG files and downloaded PDF remain on your device. Closing the tab does not delete them. If you are sharing a sensitive document, check the contents of the downloaded PDF and the destination before sending it.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="can-the-pdf-text-be-searched-or-copied">Can the PDF text be searched or copied?<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online#can-the-pdf-text-be-searched-or-copied" class="hash-link" aria-label="Direct link to Can the PDF text be searched or copied?" title="Direct link to Can the PDF text be searched or copied?" translate="no">​</a></h2>
<p>This tool creates image-based PDF pages. Text in a screenshot remains part of the image; the converter does not perform optical character recognition (OCR). Use an OCR tool if you need a searchable or selectable text layer.</p>
<p>When your images are ready, <a href="https://phcode.dev/tools/png-to-pdf.html" target="_blank" rel="noopener noreferrer" class="">open the PNG to PDF converter</a> and create your file. If you plan to print it, first read <a class="" href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality">how pixel dimensions, color and paper size affect the result</a>.</p>]]></content>
        <author>
            <name>Charly P Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="PDF" term="PDF"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[PNG to PDF Quality: Pixels, Color and Print Size]]></title>
        <id>https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality</id>
        <link href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality"/>
        <updated>2026-11-08T00:30:00.000Z</updated>
        <summary type="html"><![CDATA[Understand PNG-to-PDF image quality: original pixels, bit depth, color profiles, transparency, stored print resolution and paper-size settings.]]></summary>
        <content type="html"><![CDATA[<span class="png-pdf-guide-marker" hidden=""></span>
<p>Converting a PNG to PDF can preserve image detail, but “no quality loss” needs a precise meaning. Pixel dimensions, color profiles, bit depth and print size are different properties. Preserving one does not guarantee that all the others stay unchanged.</p>
<p>The <a href="https://phcode.dev/tools/png-to-pdf.html" target="_blank" rel="noopener noreferrer" class="">Phoenix Code PNG to PDF converter</a> preserves original PNG pixel values, dimensions and bit depth, including 16-bit images. It uses lossless compression and copies supported embedded color profiles into the PDF. <strong>Fit to image</strong> also uses stored print resolution. PDF readers, screens and printers can still affect how colors look, so check the downloaded file and keep your source PNGs.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-the-converter-preserves">What the converter preserves<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#what-the-converter-preserves" class="hash-link" aria-label="Direct link to What the converter preserves" title="Direct link to What the converter preserves" translate="no">​</a></h2>
<table><thead><tr><th>Property</th><th>Behavior in this converter</th></tr></thead><tbody><tr><td>Image pixels and dimensions</td><td>Original pixel values and dimensions are kept. A 2400 × 1600 image remains 2400 × 1600 pixels in the PDF.</td></tr><tr><td>Compression</td><td>Lossless image compression is used. Compression does not automatically mean loss of detail.</td></tr><tr><td>Color and bit depth</td><td>Original bit depth, including 16-bit values, is kept. Supported embedded color profiles are copied into the PDF. Colors without color information are treated as sRGB.</td></tr><tr><td>Transparency</td><td>Can be retained with <strong>Transparent</strong>, or placed on white with <strong>White</strong>.</td></tr><tr><td>Stored print resolution</td><td>Used by <strong>Fit to image</strong>, with a 96-pixels-per-inch fallback when no resolution is stored. Standard paper sizes change the print scale.</td></tr><tr><td>Stored orientation</td><td>Applied to the image's placement. Rotated or mirrored images keep their intended orientation.</td></tr><tr><td>Other image metadata</td><td>Not copied into the PDF.</td></tr><tr><td>Image placement</td><td>The image fits within the chosen paper and margins without cropping or stretching.</td></tr><tr><td>Text in screenshots</td><td>Remains an image. No searchable or editable OCR text layer is created.</td></tr></tbody></table>
<p>Lossless compression stores the original image samples without discarding detail. The PDF has its own structure, so its file size can be larger than the source PNG. The small browser previews remain layout aids; use the downloaded PDF to inspect fine detail and color.</p>
<p>Supported RGB and grayscale ICC profiles are copied unchanged. Standard sRGB and SDR Display P3 color information are also supported. Images with no color information use an sRGB assumption. Damaged or unsupported color information, including unsupported HDR data, produces an error. If this happens, export a standard sRGB PNG copy and try again, keeping the original for any work that needs its unsupported color data.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="pixel-dimensions-and-print-size-are-different">Pixel dimensions and print size are different<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#pixel-dimensions-and-print-size-are-different" class="hash-link" aria-label="Direct link to Pixel dimensions and print size are different" title="Direct link to Pixel dimensions and print size are different" translate="no">​</a></h2>
<p>The number of pixels alone does not determine how large an image prints. Its physical size also matters. Effective pixels per inch (PPI) are calculated as:</p>
<p><strong>PPI = pixels along one side ÷ printed inches along that side.</strong></p>
<p>For example, an image that is 2400 pixels wide provides:</p>
<table><thead><tr><th>Printed width</th><th>Effective resolution</th></tr></thead><tbody><tr><td>8 inches</td><td>300 PPI</td></tr><tr><td>12 inches</td><td>200 PPI</td></tr><tr><td>25 inches</td><td>96 PPI</td></tr></tbody></table>
<p>These are arithmetic examples, not a guarantee that a particular image meets a printer's requirements. Check the required physical dimensions and resolution for the intended print job.</p>
<p>Changing paper size does not create more detail. A larger placement spreads the same pixels over a larger area; a smaller placement brings them closer together.</p>
<figure class="png-pdf-figure"><img src="https://docs.phcode.dev/tutorials/media/png-to-pdf-print-size.svg" width="880" height="408" loading="lazy" decoding="async" alt="The same 2400-pixel image provides 300 pixels per inch at 8 inches wide, or 200 pixels per inch at 12 inches wide."><figcaption>The longer line represents a wider print of the same image. Its pixel count has not increased.</figcaption></figure>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="choose-a-page-size-for-the-intended-use">Choose a page size for the intended use<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#choose-a-page-size-for-the-intended-use" class="hash-link" aria-label="Direct link to Choose a page size for the intended use" title="Direct link to Choose a page size for the intended use" translate="no">​</a></h2>
<p>The walkthrough starts with the converter's landscape sample already added. It shows the paper, margin and transparency choices, then shows the downloaded PDF in Chrome's PDF viewer. To follow along, choose <strong>Try an example</strong> in the <a href="https://phcode.dev/tools/png-to-pdf.html" target="_blank" rel="noopener noreferrer" class="">converter</a> and remove the coastal picture, leaving the parrot.</p>
<video poster="/tutorials/media/png-to-pdf-settings-poster.png" width="1000" height="640" style="width:100%;height:auto" aria-label="PNG to PDF settings walkthrough: change from Fit to image to A4, set margins and transparency, then create and download" controls="" muted="" playsinline="" preload="metadata"><source src="/tutorials/media/png-to-pdf-settings.mp4" type="video/mp4"><track kind="captions" src="/tutorials/media/png-to-pdf-settings.vtt" srclang="en" label="English"><a href="https://docs.phcode.dev/tutorials/media/png-to-pdf-settings.mp4">Watch <!-- -->Choose PNG-to-PDF page settings</a>.</video><div class="watchAction_uyiw"><a aria-label="Open video: Choose PNG-to-PDF page settings" href="https://docs.phcode.dev/videos/png-to-pdf-page-settings">Open video<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M5 12h14m-6-6 6 6-6 6"></path></svg></a></div>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="fit-to-image">Fit to image<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#fit-to-image" class="hash-link" aria-label="Direct link to Fit to image" title="Direct link to Fit to image" translate="no">​</a></h3>
<p>Use <strong>Fit to image</strong> when you want each PDF page sized from that image's pixel dimensions and stored print resolution. The tool uses the PNG's resolution information, falling back to valid EXIF resolution and then to 96 pixels per inch when no resolution is available. Selected margins add space around the image.</p>
<p>A 2400-pixel-wide image stored at 300 pixels per inch occupies 8 inches before margins. The same image without stored resolution uses 96 pixels per inch and occupies 25 inches. Horizontal and vertical resolution can differ; the converter respects both, along with stored pixel aspect ratios and orientation.</p>
<p>The resolution setting is often called DPI in image software. Keeping that setting preserves the intended print scale, while actual print quality still depends on the source image, PDF reader and printer. If the stored resolution would create a page that is too large or too small, choose A4 or US Letter and create the PDF again.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="a4-or-us-letter">A4 or US Letter<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#a4-or-us-letter" class="hash-link" aria-label="Direct link to A4 or US Letter" title="Direct link to A4 or US Letter" translate="no">​</a></h3>
<p>Choose <strong>A4</strong> or <strong>US Letter</strong> when the receiving person or printer expects standard paper. <strong>Automatic</strong> orientation chooses portrait or landscape separately for each image; you can also select either orientation yourself.</p>
<p>The image fits inside the selected margins without cropping or stretching. This changes its printed size and effective PPI to fit the paper. If its proportions differ from the page, unused space remains. Selecting no margins does not guarantee edge-to-edge coverage on a differently shaped page, and a physical printer may impose its own unprintable borders.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="understand-transparent-backgrounds">Understand transparent backgrounds<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#understand-transparent-backgrounds" class="hash-link" aria-label="Direct link to Understand transparent backgrounds" title="Direct link to Understand transparent backgrounds" translate="no">​</a></h2>
<p>Choose <strong>Transparent</strong> to retain transparent image areas, or <strong>White</strong> to place them on white. The checkerboard in the converter is only a preview aid; it is not added to the PDF.</p>
<p>PDF readers usually display transparent pages on white. A white-looking page in a reader therefore does not, by itself, tell you whether image transparency was flattened. Check the downloaded PDF in the application where you intend to use it.</p>
<figure class="png-pdf-figure"><a href="https://docs.phcode.dev/tutorials/media/png-to-pdf-a4-transparent.png" aria-label="Open full-size screenshot of the paper and transparency settings"><img src="https://docs.phcode.dev/tutorials/media/png-to-pdf-a4-transparent.png" width="1088" height="506" loading="lazy" decoding="async" alt="The converter shows A4, Automatic orientation, 10 mm margins and Transparent selected, alongside the landscape parrot preview."></a><figcaption>Use the preview to check placement and margins. Check the downloaded PDF for fine detail and its appearance in your intended viewer.</figcaption></figure>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="check-the-downloaded-pdf-not-just-the-preview">Check the downloaded PDF, not just the preview<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#check-the-downloaded-pdf-not-just-the-preview" class="hash-link" aria-label="Direct link to Check the downloaded PDF, not just the preview" title="Direct link to Check the downloaded PDF, not just the preview" translate="no">​</a></h2>
<p>The converter's small previews show page layout. They are not a full-resolution proof of fine detail or color.</p>
<p>After selecting <strong>Create PDF</strong> and <strong>Download PDF</strong>, open the saved file and check:</p>
<ol>
<li class=""><strong>Page order and placement.</strong> Confirm that every intended image appears and that the paper, orientation and margins are suitable.</li>
<li class=""><strong>Fine detail.</strong> Inspect important text or lines at a useful viewing scale. Raster images can show pixels when magnified far enough, even when their pixel dimensions are preserved.</li>
<li class=""><strong>Color and transparency.</strong> Compare the result in the application you will actually use. Supported profiles and bit depth are preserved, but viewer and printer color management can affect appearance. Keep the original PNG for future editing or metadata you may need.</li>
<li class=""><strong>Print size.</strong> Check the PDF page dimensions and the printer's scaling settings. A viewer's “fit to page” print option can change the physical size again.</li>
</ol>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="common-questions-about-quality">Common questions about quality<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#common-questions-about-quality" class="hash-link" aria-label="Direct link to Common questions about quality" title="Direct link to Common questions about quality" translate="no">​</a></h2>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="why-is-my-pdf-larger-than-the-original-pngs">Why is my PDF larger than the original PNGs?<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#why-is-my-pdf-larger-than-the-original-pngs" class="hash-link" aria-label="Direct link to Why is my PDF larger than the original PNGs?" title="Direct link to Why is my PDF larger than the original PNGs?" translate="no">​</a></h3>
<p>A PDF has its own document structure and image representation. Transparency and image content also affect the output size. This tool does not guarantee a smaller file. The output limit is 128 MB; try a smaller batch if you reach it.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="does-local-processing-guarantee-identical-colors">Does local processing guarantee identical colors?<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#does-local-processing-guarantee-identical-colors" class="hash-link" aria-label="Direct link to Does local processing guarantee identical colors?" title="Direct link to Does local processing guarantee identical colors?" translate="no">​</a></h3>
<p>No. Processing location and color handling are separate questions. This converter preserves original pixel values, bit depth and supported color profiles while processing locally. The PDF reader, screen profile, printer, paper and print settings can still affect the visible result. Untagged images use an sRGB assumption; check the downloaded PDF in your intended viewing or printing workflow.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="can-i-make-a-low-resolution-screenshot-sharper-by-converting-it">Can I make a low-resolution screenshot sharper by converting it?<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#can-i-make-a-low-resolution-screenshot-sharper-by-converting-it" class="hash-link" aria-label="Direct link to Can I make a low-resolution screenshot sharper by converting it?" title="Direct link to Can I make a low-resolution screenshot sharper by converting it?" translate="no">​</a></h3>
<p>Conversion does not recover missing detail. Start with a higher-resolution original when possible. Enlarging a small raster image spreads the existing pixels over a larger area.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="does-changing-margins-resize-the-embedded-image">Does changing margins resize the embedded image?<a href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-without-losing-quality#does-changing-margins-resize-the-embedded-image" class="hash-link" aria-label="Direct link to Does changing margins resize the embedded image?" title="Direct link to Does changing margins resize the embedded image?" translate="no">​</a></h3>
<p>With <strong>Fit to image</strong>, margins add space around the image without changing its printed size. With <strong>A4</strong> or <strong>US Letter</strong>, margins change the area available for the image and therefore its printed size. The embedded pixel dimensions stay the same in either case.</p>
<p>For the complete selection, ordering and download workflow, follow <a class="" href="https://docs.phcode.dev/blog/how-to-convert-png-to-pdf-free-online">the free PNG to PDF conversion guide</a>. You can then <a href="https://phcode.dev/tools/png-to-pdf.html" target="_blank" rel="noopener noreferrer" class="">open the converter</a> and choose settings for your actual sharing or printing task.</p>]]></content>
        <author>
            <name>Charly P Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <category label="Tools" term="Tools"/>
        <category label="PDF" term="PDF"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Phoenix Code 5.5.11: Layers, Visual AI & ChatGPT Codex]]></title>
        <id>https://docs.phcode.dev/blog/release-5.5</id>
        <link href="https://docs.phcode.dev/blog/release-5.5"/>
        <updated>2026-10-07T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[See and edit your page’s HTML structure, try design ideas with Phoenix AI, and bring ChatGPT Codex and Claude Code CLI into a visual workflow. Plus simpler AI setup, demos, usage graphs, and photo search.]]></summary>
        <content type="html"><![CDATA[<p>Phoenix Code 5.5.11 is now available at <a href="https://phcode.dev/" target="_blank" rel="noopener noreferrer" class="">phcode.dev</a>.</p>
<p>See and edit your HTML with the new <a href="https://docs.phcode.dev/blog/release-5.5#explore-your-page-with-layers" class="">Layers panel</a>, <a href="https://docs.phcode.dev/blog/release-5.5#try-the-options-on-your-page" class="">try AI design ideas on your page</a>, <a href="https://docs.phcode.dev/blog/release-5.5#interactive-replies-in-chat" class="">explore interactive replies in chat</a>, and <a href="https://docs.phcode.dev/blog/release-5.5#bring-your-existing-cli-agents-into-phoenix-code" class="">bring your existing CLI agents into Phoenix Code</a>. There’s also <a href="https://docs.phcode.dev/blog/release-5.5#simpler-ai-setup" class="">simpler AI setup</a>, <a href="https://docs.phcode.dev/blog/release-5.5#ai-demos" class="">AI demos</a>, <a href="https://docs.phcode.dev/blog/release-5.5#ai-usage-graphs" class="">usage graphs</a>, <a href="https://docs.phcode.dev/blog/release-5.5#choose-how-much-ai-thinks" class="">thinking effort</a>, and <a href="https://docs.phcode.dev/blog/release-5.5#find-the-right-photo-with-ai" class="">photo search</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="explore-and-edit-your-page-with-layers"><a href="https://docs.phcode.dev/app-links/layers-panel" target="_blank" rel="noopener noreferrer" class="">Explore and Edit Your Page with Layers</a><a href="https://docs.phcode.dev/blog/release-5.5#explore-and-edit-your-page-with-layers" class="hash-link" aria-label="Direct link to explore-and-edit-your-page-with-layers" title="Direct link to explore-and-edit-your-page-with-layers" translate="no">​</a></h2>
<p><strong>Edit your web pages visually, without touching code!</strong> The new Layers sidebar lets you explore your page’s HTML structure, add, move, duplicate, or delete elements, and edit their properties.</p>
<p>Change colors, fonts, sizes, and spacing with simple visual controls. Every change is instantly reflected in your code and Live Preview.</p>
<blockquote>
<p>The Layers panel is a Phoenix Pro feature.</p>
</blockquote>
<p><img decoding="async" loading="lazy" src="https://docs-images.phcode.dev/in-app/pro-layersPanel.jpg" alt="Image" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="ask-ai-in-live-preview"><a href="https://docs.phcode.dev/app-links/ai-ask" target="_blank" rel="noopener noreferrer" class="">Ask AI in Live Preview</a><a href="https://docs.phcode.dev/blog/release-5.5#ask-ai-in-live-preview" class="hash-link" aria-label="Direct link to ask-ai-in-live-preview" title="Direct link to ask-ai-in-live-preview" translate="no">​</a></h2>
<p><strong>Just point and ask AI, instead of explaining what you want to change!</strong> Select any part of your page in Live Preview and ask AI to make changes. No need to describe where or what you're referring to.</p>
<p>Ask AI to suggest alternative designs, explore color schemes, or try different fonts.</p>
<p><strong>Ask AI also works with <a href="https://docs.phcode.dev/docs/Features/Live%20Preview/live-preview-settings" target="_blank" rel="noopener noreferrer" class="">custom server previews</a></strong>, including PHP and other server-rendered pages, as well as selected code or Markdown text.</p>
<blockquote>
<p>Available only in desktop apps.</p>
</blockquote>
<p><img decoding="async" loading="lazy" src="https://user-cdn.phcode.site/images/50f6bd8b-6d22-436f-ad53-8674891c457e.jpeg" alt="" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="intelligent-ui-in-ai-chat"><a href="https://docs.phcode.dev/app-links/ai-chat" target="_blank" rel="noopener noreferrer" class="">Intelligent UI in AI Chat</a><a href="https://docs.phcode.dev/blog/release-5.5#intelligent-ui-in-ai-chat" class="hash-link" aria-label="Direct link to intelligent-ui-in-ai-chat" title="Direct link to intelligent-ui-in-ai-chat" translate="no">​</a></h2>
<p><strong>See what AI means, instead of just reading about it!</strong> Phoenix AI can now show interactive designs, buttons, cards, layouts, and more directly in chat.</p>
<p>Explore different styles, click through options, and adjust controls right in the conversation. Instead of just describing an idea, AI can show you how it looks and works—all without opening Live Preview or writing code.</p>
<blockquote>
<p>This feature is available only in desktop apps.</p>
</blockquote>
<p><img decoding="async" loading="lazy" src="https://user-cdn.phcode.site/images/6d84fa6b-0a0c-47a7-b0b6-499cc20ec5fb.png" alt="" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="bring-your-claude-code--codex-cli-to-phoenix-code"><a href="https://docs.phcode.dev/app-links/ai-cli" target="_blank" rel="noopener noreferrer" class="">Bring Your Claude Code &amp; Codex CLI to Phoenix Code</a><a href="https://docs.phcode.dev/blog/release-5.5#bring-your-claude-code--codex-cli-to-phoenix-code" class="hash-link" aria-label="Direct link to bring-your-claude-code--codex-cli-to-phoenix-code" title="Direct link to bring-your-claude-code--codex-cli-to-phoenix-code" translate="no">​</a></h2>
<p><strong>Supercharge your existing CLI agents with rich, interactive visual workflows!</strong> Use your existing Claude Code or Codex subscriptions in Phoenix Code to explore designs in Live Preview, try interactive options, and make changes visually instead of relying on text descriptions.</p>
<p>Run multiple CLI sessions, switch between them easily, and send <strong>Ask AI</strong> requests directly to your agents. Track your AI consumption with the built-in <strong>AI Usage Meter</strong> (see below).</p>
<blockquote>
<p>Running CLI agents inside Phoenix Code is a Phoenix Pro feature, available only in desktop apps.</p>
</blockquote>
<p><img decoding="async" loading="lazy" src="https://user-cdn.phcode.site/images/117a072b-efd1-4623-87d7-5c20746a9b6b.gif" alt="" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="track-your-ai-usage"><a href="https://docs.phcode.dev/app-links/ai-chat" target="_blank" rel="noopener noreferrer" class="">Track Your AI Usage</a><a href="https://docs.phcode.dev/blog/release-5.5#track-your-ai-usage" class="hash-link" aria-label="Direct link to track-your-ai-usage" title="Direct link to track-your-ai-usage" translate="no">​</a></h2>
<p><strong>See how much AI you're using, all in one place!</strong> Track token usage and estimated costs across Phoenix AI, Claude Code, and Codex CLI sessions.</p>
<p>Explore daily usage graphs, monthly trends, and breakdowns by AI model. You can also clear your usage history without deleting your chats.</p>
<blockquote>
<p>Costs are estimated using API list prices and may differ from your actual provider charges. Available only in desktop apps.</p>
</blockquote>
<p><img decoding="async" loading="lazy" src="https://user-cdn.phcode.site/images/84bdfaf0-31c1-45eb-8a59-3107179f7c04.png" alt="" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="easier-ai-setup--quick-access"><a href="https://docs.phcode.dev/app-links/ai-chat" target="_blank" rel="noopener noreferrer" class="">Easier AI Setup &amp; Quick Access</a><a href="https://docs.phcode.dev/blog/release-5.5#easier-ai-setup--quick-access" class="hash-link" aria-label="Direct link to easier-ai-setup--quick-access" title="Direct link to easier-ai-setup--quick-access" translate="no">​</a></h2>
<p><strong>Get started with your favorite AI tools more easily!</strong> The new AI start screen brings Phoenix AI, ChatGPT Codex, and Claude Code CLI together in one place.</p>
<p>Quickly set up your AI tools, switch running sessions, and pick up right where you left off.</p>
<p><img decoding="async" loading="lazy" src="https://docs-images.phcode.dev/in-app/pro-aiPanel.jpg" alt="Image" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="ai-demos"><a href="https://docs.phcode.dev/app-links/ai-chat" target="_blank" rel="noopener noreferrer" class="">AI Demos</a><a href="https://docs.phcode.dev/blog/release-5.5#ai-demos" class="hash-link" aria-label="Direct link to ai-demos" title="Direct link to ai-demos" translate="no">​</a></h2>
<p>See what you can create with Phoenix AI before signing in or using any AI credits. Watch a page take shape, explore the result, and reveal the prompt behind it. Click <strong>Surprise Me</strong> to try it.</p>
<blockquote>
<p>This feature is available only in desktop apps.</p>
</blockquote>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="adjust-ai-thinking-effort"><a href="https://docs.phcode.dev/app-links/ai-chat" target="_blank" rel="noopener noreferrer" class="">Adjust AI Thinking Effort</a><a href="https://docs.phcode.dev/blog/release-5.5#adjust-ai-thinking-effort" class="hash-link" aria-label="Direct link to adjust-ai-thinking-effort" title="Direct link to adjust-ai-thinking-effort" translate="no">​</a></h2>
<p><strong>Choose how much effort AI puts into solving your problems!</strong> Use lower thinking effort for quick, simple tasks or higher effort for complex problems that need deeper reasoning.</p>
<p>Select your preferred <strong>Thinking Effort</strong> for supported AI models, or leave it at <strong>Default</strong> to use the model's standard setting.</p>
<blockquote>
<p>This feature is available only in desktop apps.</p>
</blockquote>
<p><img decoding="async" loading="lazy" src="https://user-cdn.phcode.site/images/3428ceb1-402d-4410-86ca-552bc02805b9.png" alt="" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="discover-stock-photos-with-ai"><a href="https://docs.phcode.dev/app-links/ai-images" target="_blank" rel="noopener noreferrer" class="">Discover Stock Photos with AI</a><a href="https://docs.phcode.dev/blog/release-5.5#discover-stock-photos-with-ai" class="hash-link" aria-label="Direct link to discover-stock-photos-with-ai" title="Direct link to discover-stock-photos-with-ai" translate="no">​</a></h2>
<p><strong>Find the perfect photos for your website with the help of AI!</strong> Explore real stock photos, discover new ideas, and let AI help you narrow down your choices to find images that fit your design.</p>
<p>Ask AI to add your favorite photos directly to your page or download them into your project.</p>
<blockquote>
<p>This feature is available only in desktop apps.</p>
</blockquote>
<p><img decoding="async" loading="lazy" src="https://docs-images.phcode.dev/in-app/pro-aiImages.jpg" alt="Image" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="larger-image-previews-in-markdown"><a href="https://docs.phcode.dev/app-links/markdown-editor" target="_blank" rel="noopener noreferrer" class="">Larger Image Previews in Markdown</a><a href="https://docs.phcode.dev/blog/release-5.5#larger-image-previews-in-markdown" class="hash-link" aria-label="Direct link to larger-image-previews-in-markdown" title="Direct link to larger-image-previews-in-markdown" translate="no">​</a></h2>
<p><strong>Take a closer look at images without leaving your Markdown document!</strong> Open images in a larger view to see details more clearly, whether you're reading or editing.</p>
<p>Simply click an image in reader mode, or double-click it while editing. Press <strong>Escape</strong> to return to your document.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="terminal-and-git-improvements">Terminal and Git improvements<a href="https://docs.phcode.dev/blog/release-5.5#terminal-and-git-improvements" class="hash-link" aria-label="Direct link to Terminal and Git improvements" title="Direct link to Terminal and Git improvements" translate="no">​</a></h2>
<ul>
<li class=""><strong>Name your terminals.</strong> Rename terminal tabs so you can tell your development server, build, and shell apart.</li>
<li class=""><strong>Keep your bearings after a project switch.</strong> A notice lets you keep existing terminals running or restart them in the new project's folder, with confirmation when active processes would be stopped.</li>
<li class=""><strong>Open terminal links.</strong> Applications that print clickable terminal hyperlinks can now open them in your default browser.</li>
<li class=""><strong>See what has been pushed.</strong> Git history marks the last pushed commit and identifies the local commits above it. Branches that have not been pushed get a clear indication too.</li>
<li class=""><strong>Open projects without Git interruptions.</strong> Projects without a repository no longer trigger a “getting remotes” error dialog.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="notable-fixes-and-performance-improvements">Notable fixes and performance improvements<a href="https://docs.phcode.dev/blog/release-5.5#notable-fixes-and-performance-improvements" class="hash-link" aria-label="Direct link to Notable fixes and performance improvements" title="Direct link to Notable fixes and performance improvements" translate="no">​</a></h2>
<ul>
<li class="">Fixed a race where a delayed file reload could overwrite text typed or saved while the reload was in progress. (<a href="https://github.com/phcode-dev/phoenix/commit/e00a5a588" target="_blank" rel="noopener noreferrer" class="">Change</a>)</li>
<li class="">Fixed stale Markdown preview updates reverting newer edits made in the code editor. (<a href="https://github.com/phcode-dev/phoenix/commit/f2f2382fb" target="_blank" rel="noopener noreferrer" class="">Change</a>)</li>
<li class="">Live Preview reconnects after a dropped connection, and incomplete HTML is handled more reliably while you type. (<a href="https://github.com/phcode-dev/phoenix/commit/44e914f2c" target="_blank" rel="noopener noreferrer" class="">Reconnect</a>, <a href="https://github.com/phcode-dev/phoenix/commit/9b57186ae" target="_blank" rel="noopener noreferrer" class="">HTML editing</a>)</li>
<li class="">Reduced repeated CSS parsing, page measurements, and tree rebuilding during selection and editing in Live Preview and Layers.</li>
<li class="">Fixed JavaScript hints getting stuck while indexing HTML or PHP, and older project preferences arriving after a project switch. (<a href="https://github.com/phcode-dev/phoenix/commit/1198f7f3a" target="_blank" rel="noopener noreferrer" class="">Hints</a>, <a href="https://github.com/phcode-dev/phoenix/commit/b24ad37a0" target="_blank" rel="noopener noreferrer" class="">Preferences</a>)</li>
<li class="">Python and PHP language-server setup now limits automatic retries and keeps error details and a manual retry available in the task list. Python tooling also updates to Pyrefly 1.2.0 and Ruff 0.16.5. (<a href="https://github.com/phcode-dev/phoenix/commit/9325978d4" target="_blank" rel="noopener noreferrer" class="">Setup</a>, <a href="https://github.com/phcode-dev/phoenix/commit/391fd391b" target="_blank" rel="noopener noreferrer" class="">Tooling</a>)</li>
<li class="">Fixed the sidebar resize handle being left over the editor after the sidebar was collapsed. (<a href="https://github.com/phcode-dev/phoenix/commit/e0107ea35" target="_blank" rel="noopener noreferrer" class="">Change</a>)</li>
<li class="">Dropping several files now leaves the last file in the drop order active, regardless of which one loads fastest. (<a href="https://github.com/phcode-dev/phoenix/commit/9d896d2c7" target="_blank" rel="noopener noreferrer" class="">Change</a>)</li>
<li class="">Notifications stay open while you hover over them, giving you time to read or use their actions. (<a href="https://github.com/phcode-dev/phoenix/commit/a40ab64e9" target="_blank" rel="noopener noreferrer" class="">Change</a>)</li>
<li class="">AI plan review now handles approval, revision, cancellation, and stopping more consistently. Chat also resumes following new messages after you have scrolled back to read older replies.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="platform-and-account-notes">Platform and account notes<a href="https://docs.phcode.dev/blog/release-5.5#platform-and-account-notes" class="hash-link" aria-label="Direct link to Platform and account notes" title="Direct link to Platform and account notes" translate="no">​</a></h2>
<ul>
<li class=""><strong>Windows:</strong> Fixed AI multiline edits being rejected when the file and the AI used different line endings. Language-server quick fixes also handle drive-letter capitalization correctly.</li>
<li class=""><strong>macOS:</strong> Improved semibold and bold text rendering in the interface.</li>
<li class=""><strong>Managed desktop installations:</strong> Administrators can point the updater at a custom update manifest, including a custom Linux installer URL.</li>
<li class=""><strong>Accounts:</strong> Desktop sign-in refreshes Pro access immediately, and existing subscribers no longer receive prompts to buy Pro again.</li>
</ul>
<p>Get the update at <a href="https://phcode.dev/" target="_blank" rel="noopener noreferrer" class="">phcode.dev</a>, and let us know what you build in <a href="https://github.com/phcode-dev/phoenix/discussions" target="_blank" rel="noopener noreferrer" class="">GitHub Discussions</a>.</p>]]></content>
        <author>
            <name>Arun Bose</name>
            <uri>https://github.com/abose</uri>
        </author>
        <author>
            <name>Devansh Agarwal</name>
            <uri>https://github.com/devvaannsh</uri>
        </author>
        <author>
            <name>Charly P Abraham</name>
            <uri>https://github.com/charlypa</uri>
        </author>
        <author>
            <name>Krrish Parmar</name>
            <uri>https://github.com/Electrofist</uri>
        </author>
        <author>
            <name>Ansu Ann Koshy</name>
            <uri>https://github.com/AnsuKoshy</uri>
        </author>
        <author>
            <name>Phoenix Code Bot</name>
            <uri>https://github.com/phoenixide</uri>
        </author>
        <category label="Live Preview Edit" term="Live Preview Edit"/>
        <category label="AI" term="AI"/>
        <category label="Claude Code" term="Claude Code"/>
        <category label="Git" term="Git"/>
        <category label="Phoenix Pro" term="Phoenix Pro"/>
        <category label="Windows" term="Windows"/>
        <category label="Linux" term="Linux"/>
        <category label="Mac" term="Mac"/>
        <category label="Release" term="Release"/>
    </entry>
</feed>