{"id":125370,"date":"2025-12-02T16:11:42","date_gmt":"2025-12-02T16:11:42","guid":{"rendered":"\/ph\/tutorials\/how-to-insert-an-image-in-html"},"modified":"2026-03-10T09:33:02","modified_gmt":"2026-03-10T09:33:02","slug":"how-to-insert-an-image-in-html","status":"publish","type":"post","link":"\/ph\/tutorials\/how-to-insert-an-image-in-html","title":{"rendered":"How to insert an image in HTML in 7 easy steps"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Learning how to insert an image in HTML is important when you need to place a logo or graphic in a specific spot, like a header or footer, where your theme or content editor doesn&rsquo;t allow it.<\/p><p>Adding images directly with HTML gives you full control over your site&rsquo;s visual presentation. This enhances user engagement by breaking up text and improves branding by letting you place elements like logos exactly where they belong.<\/p><p>Here are the seven main steps to get your image live on your website:<\/p><ol class=\"wp-block-list\">\n<li><strong>Set up and upload the image<\/strong>. Get your image file ready and upload it to your website&rsquo;s server so it has a web-accessible URL.<\/li>\n\n\n\n<li><strong>Open your theme&rsquo;s HTML file<\/strong>. Find the correct template file, like <strong>header.php<\/strong> or <strong>footer.php<\/strong>, where you want the image to appear.<\/li>\n\n\n\n<li><strong>Insert the img src attribute<\/strong>. Write the basic HTML <strong>&lt;img&gt;<\/strong> tag and use the <strong>src<\/strong> attribute to point to your image&rsquo;s URL.<\/li>\n\n\n\n<li><strong>Specify the image dimensions<\/strong>. Define the image&rsquo;s width and height to prevent your page layout from shifting as it loads.<\/li>\n\n\n\n<li><strong>Add an alt attribute<\/strong>. Provide alternative text for accessibility and SEO, describing the image for screen readers and search engines.<\/li>\n\n\n\n<li><strong>Check for errors and save the changes<\/strong>. Review your code for typos and save the file to make your changes live.<\/li>\n\n\n\n<li><strong>Insert a link to the image<\/strong>. Make your image clickable by wrapping it in an anchor (<strong>&lt;a&gt;<\/strong>) tag, linking it to your homepage or another relevant page.<\/li>\n<\/ol><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-1-prepare-and-upload-your-image\">1. Prepare and upload your image<\/h2><p>Before you can add an image with code, that image needs to exist on your web server. This step involves optimizing your image file and uploading it to a location where it gets a direct, web-accessible URL, which you&rsquo;ll need for the <strong>src<\/strong> attribute later.<\/p><p>For WordPress users, the most common way to do this is through the Media Library:<\/p><ol class=\"wp-block-list\">\n<li>From your WordPress dashboard, navigate to <strong>Media &rarr; Add New<\/strong>.<\/li>\n\n\n\n<li>Drag and drop or select your image file to upload it.<\/li>\n\n\n\n<li>Once uploaded, click the <strong>Copy URL to Clipboard<\/strong> button next to the picture. Keep this URL handy for the next steps.<\/li>\n<\/ol><div class=\"wp-block-image is-style-default\"><figure data-wp-context='{\"imageId\":\"69e205787bbdd\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/09\/wordpress-admin-upload-new-media-copy-url-to-clipboard-highlighted-1024x503.png\" alt=\"Copy URL to Clipboard button highlighted in WordPress Media page\" class=\"wp-image-136191\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Alternatively, you can use your hosting control panel&rsquo;s file manager. This method is great for static sites or for placing images outside the standard WordPress uploads folder.<\/p><p>For example, Hostinger users can use our intuitive File Manager. This tool gives you direct control over your site&rsquo;s file structure. Simply navigate to your <strong>public_html<\/strong> directory (or a subfolder like <strong>images<\/strong>), and use the <strong>Upload<\/strong> button to add your file.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e205787d65f\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/09\/hpanel-file-manager-upload-highlighted-1024x332.png\" alt=\"Upload button highlighted in Hostinger File Manager public_html folder\" class=\"wp-image-136192\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-full\"><a href=\"\/ph\/web-hosting\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/11\/Web-hosting_in-text-banner.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/11\/Web-hosting_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/11\/Web-hosting_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/11\/Web-hosting_in-text-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-2-access-your-theme-s-html-file\">2. Access your theme&rsquo;s HTML file<\/h2><p>Accessing your theme&rsquo;s HTML file involves editing the core template files, like <strong>header.php<\/strong> or <strong>footer.php<\/strong>, which control your site&rsquo;s layout. To make your image appear on every page (like a header logo), you must edit these files rather than a single post.<\/p><p>Before editing theme files, always create a backup of your website. A small mistake here could break your site, and a backup means you can restore it quickly.<\/p><p>We also strongly recommend making these changes in a <a href=\"\/ph\/tutorials\/how-to-create-wordpress-child-theme\">child theme<\/a> to prevent your customizations from being overwritten when you update your main theme.<\/p><p>Once you have a backup, follow these steps in the <a href=\"\/ph\/tutorials\/wordpress-theme-editor\">WordPress theme editor<\/a>:<\/p><ol class=\"wp-block-list\">\n<li>From the WordPress dashboard, go to <strong>Appearance &rarr; Theme File Editor<\/strong>.<\/li>\n\n\n\n<li>On the right, select the active theme you&rsquo;re using.<\/li>\n\n\n\n<li>Find the file you want to edit. For a logo in the header, this is typically <strong>header.php<\/strong>. For an item in the footer, it&rsquo;s <strong>footer.php<\/strong>.<\/li>\n\n\n\n<li>Click the file to open it in the editor.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e2057880f9a\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/09\/wordpress-admin-edit-themes-header-php-selected-1024x578.png\" alt=\"header.php selected in the WordPress Theme File Editor panel\" class=\"wp-image-136205\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-3-add-the-img-src-attribute-to-the-image\">3. Add the img src attribute to the image<\/h2><p>To add the <strong>img src<\/strong> attribute, you will add the <strong>&lt;img&gt;<\/strong> tag to your HTML file and use the <strong>src<\/strong> attribute to define the image&rsquo;s URL. The <strong>&lt;img&gt;<\/strong> tag is what tells the browser to display an image. It&rsquo;s an &ldquo;empty&rdquo; tag, meaning it doesn&rsquo;t need a closing tag (like <strong>&lt;\/img&gt;<\/strong>).<\/p><p>The <strong>src<\/strong> attribute (short for &ldquo;source&rdquo;) is the most crucial part, as it tells the browser where to find the image. This is where you&rsquo;ll paste the File URL you copied from your Media Library in step 1.<\/p><p>Find the right spot in your code (for example, inside the <strong>&lt;header&gt;<\/strong> section in <strong>header.php<\/strong>) and add the following code snippet. Be sure to replace the placeholder URL with your actual image URL:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;img src=\"https:\/\/your-domain.tld\/wp-content\/uploads\/2025\/11\/your-image.png\"&gt;<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e20578824aa\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/09\/wordpress-admin-edit-themes-img-src-highlighted-1024x504.png\" alt=\"Mage source line highlighted in WordPress Theme File Editor\" class=\"wp-image-136207\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>This full URL is called an absolute path, which is the most reliable method to use when editing theme files.<\/p><h2 class=\"wp-block-heading\" id=\"h-4-define-the-image-width-and-height\">4. Define the image width and height<\/h2><p>You define the image width and height by adding the <strong>width<\/strong> and <strong>height<\/strong> attributes directly to your <strong>&lt;img&gt;<\/strong> tag. These attributes are critical for web performance and user experience because they tell the browser exactly how much space to reserve for the image before it even loads.<\/p><p>This practice prevents Cumulative Layout Shift (CLS), an annoying issue where page content &ldquo;jumps around&rdquo; as images load.<\/p><p>Add the <strong>width<\/strong> and <strong>height<\/strong> attributes to your <strong>&lt;img&gt;<\/strong> tag, specifying the image&rsquo;s original dimensions in pixels.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;img src=\"https:\/\/your-domain.tld\/wp-content\/uploads\/2025\/11\/your-image.png\" width=\"180\" height=\"60\"&gt;<\/pre><p>Please note that you only need to add the numbers. Do not add <strong>px<\/strong> inside the HTML attributes. Even if you use CSS to make the image responsive, setting these HTML attributes is still a best practice to define the image&rsquo;s original aspect ratio.<\/p><h2 class=\"wp-block-heading\" id=\"h-5-write-a-descriptive-alt-attribute\">5. Write a descriptive alt attribute<\/h2><p>The <strong>alt<\/strong> attribute (or alt text) is a short text description of your image. It&rsquo;s essential for two main reasons:<\/p><ul class=\"wp-block-list\">\n<li><strong>Accessibility<\/strong>. Screen readers use the <strong>alt<\/strong> text to describe the image to visually impaired users, making your site accessible to everyone.<\/li>\n\n\n\n<li><strong>SEO<\/strong>. Search engines use <strong>alt<\/strong> text to understand the image&rsquo;s content and context, which can help your images rank in search results.<\/li>\n<\/ul><p>Your <strong>alt<\/strong> text should be concise and descriptive. If the image is simply your logo, the alt text should be your company name followed by &ldquo;logo&rdquo;.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;img src=\"https:\/\/your-domain.tld\/wp-content\/uploads\/2025\/11\/your-image.png\" width=\"180\" height=\"60\" alt=\"A cat image\"&gt;<\/pre><h2 class=\"wp-block-heading\" id=\"h-6-check-for-errors-and-save-the-changes\">6. Check for errors and save the changes<\/h2><p>To check for errors and save changes, you must review your <strong>&lt;img&gt;<\/strong> tag for typos and then click the <strong>Update File<\/strong> button in the WordPress editor. A single misplaced character or unclosed quote in your <strong>&lt;img&gt;<\/strong> tag can cause the image to break or affect the page layout.<\/p><p>Review your line of code one more time. Your complete <strong>&lt;img&gt;<\/strong> tag should look something like this:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;img src=\"https:\/\/your-domain.tld\/wp-content\/uploads\/2025\/11\/your-logo.png\" width=\"180\" height=\"60\" alt=\"A cat image\"&gt;<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e2057883a9c\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/09\/wordpress-admin-edit-themes-img-src-width-height-alt-highlighted-1024x608.png\" alt=\"Full img tag with src, width, height, and alt highlighted in editor\" class=\"wp-image-136208\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Once you&rsquo;re confident it&rsquo;s correct, click the <strong>Update File<\/strong> button at the bottom of the Theme File Editor. Open your website in a new tab or a private browsing window and reload the page to see your new image.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e2057884a43\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/09\/wordpress-header-image-1024x498.png\" alt=\"New header image displayed on a WordPress site after update\" class=\"wp-image-136209\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-7-add-a-link-to-the-image\">7. Add a link to the image<\/h2><p>You can add a link to an image by wrapping your <strong>&lt;img&gt;<\/strong> tag with an anchor (<strong>&lt;a&gt;<\/strong>) tag. An image in your header or footer, especially a logo, should almost always be a clickable link.<\/p><p>Users instinctively click on the logo to return to the homepage. Making your image a link is a &ldquo;must-do&rdquo; step for good site navigation and user experience.<\/p><p>The <strong>&lt;a&gt;<\/strong> tag uses the <strong>href<\/strong> attribute to define its destination URL. Here&rsquo;s how to link your new logo to your website&rsquo;s homepage:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;a href=\"https:\/\/your-domain.tld\/\"&gt;\n   &lt;img src=\"https:\/\/your-domain.tld\/wp-content\/uploads\/2025\/11\/your-logo.png\" width=\"180\" height=\"60\" alt=\"A cat image\"&gt;\n&lt;\/a&gt;<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e2057885c3c\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/09\/wordpress-admin-edit-themes-a-href-img-src-highlighted-1024x536.png\" alt=\"a href and img src code highlighted in the WordPress Theme Editor\" class=\"wp-image-136210\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>After adding this code, click <strong>Update File<\/strong> again. Now, when you visit your site, your logo will not only be visible but will also function as a link.<\/p><h2 class=\"wp-block-heading\" id=\"h-next-steps-organize-your-images-in-the-wordpress-media-library\">Next steps: Organize your images in the WordPress Media Library<\/h2><p>Manually inserting an image using HTML is perfect for theme elements like logos. But as your site grows, you&rsquo;ll be uploading dozens or even hundreds of images for your posts and pages.<\/p><p>This is where managing your assets becomes critical. A messy <a href=\"\/ph\/tutorials\/wordpress-media-library-tutorial\">WordPress Media Library<\/a> makes it hard to find images, reuse content, and get the correct URLs.<\/p><p>To organize your WordPress Media Library, you can install a plugin like <strong>FileBird<\/strong> to create virtual folders, and then simply drag and drop your media files into them.<\/p><p>By organizing your media with folders, you create a much faster and more reliable workflow for all your future content.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learning how to insert an image in HTML is important when you need to place a logo or graphic in a specific spot, like a header or footer, where your theme or content editor doesn&rsquo;t allow it. Adding images directly with HTML gives you full control over your site&rsquo;s visual presentation. This enhances user engagement [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ph\/tutorials\/how-to-insert-an-image-in-html\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":27,"featured_media":126299,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to insert an image in HTML in 7 steps","rank_math_description":"Learn how to insert an image in HTML to customize your site. Follow steps to add the img tag and set src, alt, and size attributes.","rank_math_focus_keyword":"how to insert an image in html","footnotes":""},"categories":[22598],"tags":[],"class_list":["post-125370","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-development"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-insert-an-image-in-html","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/como-inserir-imagem-html-no-site","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/inserer-une-image-html","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/insertar-imagen-html","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/cara-memasukkan-gambar-di-html","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-insert-an-image-in-html","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/insertar-imagen-html","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/insertar-imagen-html","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/insertar-imagen-html","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/como-inserir-imagem-html-no-site","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-insert-an-image-in-html","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-insert-an-image-in-html","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-insert-an-image-in-html","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-insert-an-image-in-html","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-insert-an-image-in-html","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-insert-an-image-in-html","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/125370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/comments?post=125370"}],"version-history":[{"count":1,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/125370\/revisions"}],"predecessor-version":[{"id":126296,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/125370\/revisions\/126296"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media\/126299"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media?parent=125370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/categories?post=125370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/tags?post=125370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}