skip to Main Content

Attempting to set up a logo button for my project, which would reload the page on-click. As of now, the file is saved in the images folder in the project itself. However, it doesn’t show up on the page. I tried taking out the styling from the button, to no avail.

Below is the HTML for the button. The img src is the relative path copied from the file in VS Code.

<h3 style="text-align:center;">
      <button id = "logo" style="text-align:center;font-size:30px;font-family:Courier New;color:yellow;background-color:black;border: 1px solid" value = "Ryder">
        <img src="imagesbykr_logo.jpg" border="0"/>
      </button>
    </h3>

I tried using the absolute path with file///: as other answers mentioned, and even changing it to an input of button type, doesn’t work. Any help would be great!

2

Answers


  1. this code is working for me.

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
        <h3 style="text-align:center;">
          <button id = "logo" style="text-align:center;font-size:30px;font-family:Courier New;color:yellow;background-color:black;border: 1px solid" value = "Ryder">
        </button>
        <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAAB9CAMAAAC4XpwXAAAAZlBMVEX///8jHyAAAAAcFxgfGxz39/f7+/vy8vIJAAAUDhAYExTV1NQeGRq1tLTd3d2qqamPjo7Ew8N7eXnn5+eIh4ehoKA8OTpEQUIPBwljYWJTUVJLSEkuLCzMy8uVk5O+vb1ta2xbWloYKsSeAAAEaUlEQVRogd2b25aqMAyGbSjQFqh4ggoo8P4vudGZcUZQSaWpa+3/2sVnStocGlar/0thctgWffgRts5LI6Qq4g+wkw4gZYzxD9D1ESS7yj89zEGxbwWV5/ee1MBuUke/8IypXzgze6/w9dXZboK1T3gG7E6gPcI3IzhTkT+4Dvg9XG79wcNKjkyHkz96Pl53zvzB9RjO4OCPXgQjeFr487mJvzPIvMFX1dh02fszPZmYrjyeNHszXnePh2xcpCO4x4NmsvCm9ggfYtu9x5Vec5qtuYfvfMJX/d+cAirP2Vz163QBnP2yV2H5Q0+h9hjY7uhcinL9gfqhBAFCNt3mI5VT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0E23eXxqh8m+FELxn7+4djXdHW2OzAwKii571X+JT+e+4VLy5nva1pVCfTolqKbjTmsk+R/6k0dRcUDNkwAAAABJRU5ErkJggg==" />
        <!-- <img src=".imagesbykr_logo.jpg.jpg" /> -->
        </h3>
    </body>
    </html>

    just make the directory name "images" in the project and name the logo "bykr_logo.jpg.jpg"
    if you want to use the absolute path with file///:
    just right-click on the file in vs code and click copy path and paste it into the browser URL, browser loads your image wi the absolute path.

    Login or Signup to reply.
  2. Maybe if you specify the full path to the image like

    c:/path-to-image-folder/images/bykr_logo.jpg
    

    or if you base your path from the current working directory, notice the dot at the beginning like

    ./images/bykr_logo.jpg
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search