Linked Questions

13 votes
5 answers
25k views

How to set a External SVG color in HTML using CSS? [duplicate]

I am trying to use SVG on my web page. But it's color is black. So, I want it to be changed. So, I have done- .red_color_svg { color: red; border: 5px solid currentColor; fill: ...
S M Abrar Jahin's user avatar
1274 votes
47 answers
3.0m views

How can I change the color of an 'svg' element?

I want to use this technique and change the SVG color, but so far I haven't been able to do so. I use this in the CSS, but my image is always black, no matter what. My code: .change-my-color { ...
Barbara's user avatar
  • 14.3k
834 votes
61 answers
837k views

RGB to hex and hex to RGB

How to convert colors in RGB format to hex format and vice versa? For example, convert '#0080C0' to (0, 128, 192).
Sindar's user avatar
  • 10.7k
330 votes
13 answers
645k views

Can I change the fill color of an svg path with CSS?

I have the following code: <span> <svg height="32" version="1.1" width="32" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; ...
Samantha J T Star's user avatar
153 votes
16 answers
225k views

How to style SVG with external CSS?

I have several SVG graphics I'd like to modify the colors of via my external style sheets - not directly within each SVG file. I'm not putting the graphics in-line, but storing them in my images ...
Jordan H's user avatar
  • 54.5k
120 votes
6 answers
104k views

How to apply a style to an embedded SVG?

When an SVG is directly included in a document using the <svg> tag, you can apply CSS styles to the SVG via the document's stylesheet. However, I am trying to apply a style to an SVG which is ...
Joshua Sortino's user avatar
16 votes
1 answer
19k views

Styling SVG with CSS in the containing HTML

I have a SVG file containing one simple triangle named. The file is named indicator.svg: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3....
AlexStack's user avatar
  • 17.1k
-1 votes
2 answers
9k views

Changing SVG color using CSS

I tried to change the svg picture color in my html using css and i tried using fill=currentColor in the svg doc as well but it didnt give me the expected result I tried various tutorials and methods ...
adala nane's user avatar
0 votes
2 answers
2k views

Programmatically change SVG classes during runtime

-I want to draw the same SVG onto a canvas multiple times, but each time I want to PROGRAMMATICALLY change the colors of specific classes within that SVG. For example take this house image below: The ...
Sirab33's user avatar
  • 1,275
2 votes
1 answer
1k views

Inline External SVG

I'd like to use an external SVG image for social media links that I can use the CSS fill property for. HTML looks like this: <a><svg width="30" height="30"> <use xlink:href="image/...
CurtisUpshall's user avatar
2 votes
1 answer
2k views

Load external SVG into the DOM, current document not subdocument

I am trying to load an external SVG document into a simple web page so that I can use it as a basic chloropeth map. However, using <object data=""></object> in the HTML results in the SVG ...
James's user avatar
  • 2,508
2 votes
0 answers
172 views

How to access SVG inside <object> HTML tag

I have an object html tag and I am passing it an external SVG url through the data="" attribute. Does anyone know how to access the SVG inside the <object>? I would like to change the ...
Why u do dis's user avatar