Ask Your Question
0

How to give an <svg> element a double border using CSS when there is no style attribute present?

asked 2022-05-14 11:00:00 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-11-10 10:00:00 +0000

bukephalos gravatar image

If there is no style attribute present in the SVG element, you can add a CSS style to the element by either adding a class or an ID to it, and then applying the CSS style to that class or ID.

For example, if you add a class to the SVG element like this:

<svg class="double-border"></svg>

You can then apply a double border using CSS like this:

.double-border {
  border: 3px solid black;
  border-width: 3px 6px;
}

This will create a double border around the SVG element with a black color and a width of 3px and 6px, respectively.

Alternatively, if you add an ID to the SVG element like this:

<svg id="double-border"></svg>

You can apply the same CSS style to that ID like this:

#double-border {
  border: 3px solid black;
  border-width: 3px 6px;
}
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-05-14 11:00:00 +0000

Seen: 15 times

Last updated: Nov 10 '21