Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Trying to add svg arrows to my slider gallery- but they disappear when added

Edrol97

Silver Coder
Example of what I'm talking about below and all I've changed is the code of one of the images. They have the same file path, same name, just a different extensionScreenshot 2025-04-10 at 23.35.12.webp
versus how it should look below: Screenshot 2025-04-10 at 23.37.12.webpIs there a way to resolve this?
 
Can you share a snippet of your code?
HTML:
 <div class="slide-show_containers">
                <div class="slide-show_1container">
                  <div class="next_button" onclick="NextImage()">
                    <img src="img/background/right-arrow.svg" class="responsive"/>
                  </div>
                  <div class="previous_button" onclick="PreviousImage()">
                    <img src="img/background/left-arrow.png" draggable="false" class="responsive"/>
                  </div>
                  <div class="close_button" onclick="CloseLightbox(1)">
                    <img src="img/background/close-button.png" draggable="false" class="responsive"/>
                  </div>
 
HTML:
 <div class="slide-show_containers">
                <div class="slide-show_1container">
                  <div class="next_button" onclick="NextImage()">
                    <img src="img/background/right-arrow.svg" class="responsive"/>
                  </div>
                  <div class="previous_button" onclick="PreviousImage()">
                    <img src="img/background/left-arrow.png" draggable="false" class="responsive"/>
                  </div>
                  <div class="close_button" onclick="CloseLightbox(1)">
                    <img src="img/background/close-button.png" draggable="false" class="responsive"/>
                  </div>
as you already confirmed with your left arrow png seems to work so it should be related to the svg itself

just some ideas:

  • Incorrect SVG file path: Double-check for typos or case sensitivity in "img/background/right-arrow.svg".
  • SVG file is empty or broken: Open the .svg file in a browser—if it doesn’t render, it may lack valid shapes or content.
  • SVG has fill="none" or opacity="0": Inspect the SVG code for styles that make it invisible.
  • SVG uses external styles: If the SVG references external CSS (e.g., via &lt;style&gt; tags), these won’t apply when embedded as an &lt;img&gt;.
  • ViewBox or dimensions missing: The SVG might not scale correctly if it lacks a proper viewBox, width, or height attribute.
  • CSS conflict: Your .responsive or parent styles may override size or visibility.
  • Browser support quirks: Rare, but test the SVG in multiple browsers to rule out rendering issues.
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom