I’ve got a tricky issue going on that I can’t seem to figure out. It’s a lot of different files so let’s start without any code or file docs added.
So I’ve got a SVG image with a lot of square paths all over it. I placed an Square image over one of the square paths in Inkscape. Then I embedded the SVG file into HTML, where I think added a link to that path w/ image. I was having no issues adding the links or anything and it was working just fine, but now it seems as if the image is canceling out the link. Before the link worked just fine but when the image loads over the square it acts as if it’s covering the link. Before the image is fully loaded into the browser the link works and is accessible. But once the image loads on top of that path with the link it covers it and doesn’t work anymore.
Is this common and am I dumb? Seems like I’m just missing something here. Need to basically add the image somehow without it covering the linked path underneath.
Please help!!!
You have probably already found the answer. In SVG all elements are drawn on top of all previous (so the order of the elements in the file matters).
If one element completely covers the other below him then it will essentially block its interactive events. The solution is to notify CSS engine to drop through any pointer events for this element (or elements with same style) using
.nopointer { pointer-events: none }
in the section of the SVG or in the wrapped HTML CSS style section.
For the links to work for SVG elements - since you can add a link attribute to SVG elements as well, e.g. if you would have SVG IMAGE elements overlaid on your rectangles - don't forget to add the XLink namespace in the SVG root element declaration.
Related
I'm trying to figure out the most adapted way to use an SVG (a logo) on a website's header. I want the logo to be clickable, and change color when hovered on.
I've seen theses differents methods : inline SVG, iframe, object,img, embed and as background-image :
I won't use the img and background-image, because I understood you can't modify theses easily (i.e. I can't say "make the image to this specific hue").
iframe and embed seem to be not recommended.
So I looked more closely at inline SVG and object.
I like the conveniency of the inline SVG to modifiy it with CSS, but I'm not a fan of displaying in the gcode how to replicate the logo, and to have a big chunck of code that I would have to modify is the logo changes
I can display the svg with easily, but I haven't found a way to modify the infill with this method.
So my very first question is about the method object : is there a way to modify the proprieties (i.e. fill) of the svg on the go ?
If not, am I just to demanding and I should just stick with the inline svg ?
Cheers,
As illustrated in this topic, using an object isn't quite an easy solution for my problem.
And as #Hoff suggested in the comment, the SVG is the most suitable option for me, and replicating an svg is trivial.
So svg inline it is !
Thanks.
I get strange behavior when I try to insert icons to my elementor page design in SVG format.
This is the original design (supplied with zeplin.io) which im trying to implement with elementor
before I add the last icon, the result in elementor is:
You can see that only the first icon display as expected
Which is strange, but even more strange is that when I had the last I con I get this:
Now non of the icon display as expected, although some of then are more similar to the expected result.
The heart icon got flipped, and the colors changed for the other icons,
Why would adding a new icon effect other icons in such a way?
Why the color and the icon direction doesn't display as set by the SVG design?
NOTE, the direction might be RTL related, but why only the heart got flipped?
I know that I could easily solve this issue by changing the format to PNG, but I could like to understand the reason behind this behavior.
This is happens because the icons have duplicate class values, i.e. the svg is added as-is to the dom tree, along with the <style> definitions.
Therefore any class or id that is duplicated in two SVGs will collide, and the solution is
open the svg with any text editor
search/replace all id/class defined in <style> to have unique name
NOTE: the reason it doesn't happen in the orginial design is that there, the SVGs are added with img tag.
Woprdpress doesn't allow uploading SVGs as images for security reason (I have no idea what kind of security issue it can create, but this is a question by itself)
EDIT: I just noticed that once you add an SVG as an icon, it also become available as an image, so it might be a better solution to upload the SVG as icon and then use them as images. but I didn't try it.
First of all, let me preface this by saying I am NOT trying to apply additional CSS to the contents of an iframe from the parent document. I am having issues with a perfectly working document that when displayed in an iframe, the styling breaks. I only say this because whenever I google this issue that's all I get.
I have an HTML document that works and displays perfectly fine when viewed in a browser by itself, however I need to show this content in an iframe. The issue is that somehow, it seems like it's randomly picking and choosing which CSS properties get applied.
For example, if you check the fiddle linked below and inspect one of the list items in the iframe, you can see that the li tags have a border-bottom set. However, if you look at the .service ul li selector in the code, you'll see that there is actually a border-left and border-right there as well which are being ignored. This is only one of the many weird things happening. If you inspect around the document you'll see more instances where this happens.
I've never seen anything like this and it makes no sense at all. I can literally see elements in the inspector where some CSS properties from the same selector are working, and some are ignored. This document displays without issue outside of an iframe.
fiddle
BTW the code is loaded from a data string rather than a URL because it's rendered from an ejs template and it is not served on a public route, nor do I want it to be. However this should be irrelevant.
There is a conflict with the hash "#" symbol in your css. Switching your hex color to red fixes the issue in your fiddle. You will have to come up with another way to add the color without introducing unwanted characters inside your iframe html code that is inside an attribute.
So, I have an SVG path animated with CSS animation. This animated SVG is set as a background image of the div. The issue is that when I refresh the page, CSS background-image gets cached which leads to animation not getting executed but it shows the final fully displayed SVG. I have checked out the solutions from other users by getting random strings. This solution works by creating random strings on each refresh. In my case, I can't use any scripts. So, is there any way around this besides putting my SVG in HTML file? Thanks
I am currently transitioning a site from one host to another. The original .swf files I am trying to replace but for some reason there is a strange looking border around the images. Can anyone explain why or how to fix it?
Here is the site that is currently being hosted where the header image .swf file is displayed properly:
http://www.waimeasmiles.com
This is the site under the new host where the strange border is:
http://waimeasmiles.com.192-185-7-17.secure22.win.hostgator.com/smile_gallery.asp
Thanks for any help.
That's a weird little border alright. I've glanced over the code and didn't see anything glaring. I can tell you that the "border" you're seeing is the swf's declared background color. (One black, the other white.) It's as if the swfs have a 1px offset but from what I can see nothing has changed regarding their embed or styles.
In fact, one of the only differences I noticed while scanning your code was:
The original location's html has a closing paragraph tag at the end of the file (outside the closing body and html tags) but it seems to have been removed from the new location's html.
Errant or "catch-all" closing tags are bad, mmmk. I can't think of any reason this would affect the flash, but considering the heavily nested, difficult to read code on that page, I might try adding it back just for the sake of having tried it. ;)
Aside from that you may want to try "zeroing out" some elements in your css to see if that helps. Something like:
div, object {
margin:0px;
padding:0px;
border:none;
outline:none;
}