-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Two div elements wrap svg icon #24
Comments
+1 |
That was actually how this module was originally created, however:
|
Hi, Thank you, |
@DavidSvetlik: without seeing your use-case I'm guessing a bit, but one way you can do this is wrap the output of this module in your own element which does have a class or id etc, then work from that to target the divs perhaps via a descendant selector. If you want to provide a use-case, can you please open a new issue as well and we can work from that? (What you're asking sounds different to this original report). |
@tanem You are right, I can wrap it in another element. Thanks. |
Would love an example of the solution |
@iporollo if we use the example contained in this repo, what I'm getting at is doing something like this: <div className="wrapper">
<ReactSVG
path="atomic.svg"
callback={svg => console.log(svg)}
className="example"
/>
</div> Then, you can use CSS however you like to target the internal elements, e.g.: .wrapper > div { ... }
.wrapper > div > div { ... }
.wrapper svg { ... } |
Can we wrap the svg in |
Hey @austincondiff the reasons for the wrapping were posted earlier in this thread. Long story short:
|
Just use https://www.npmjs.com/package/react-inlinesvg No unnecessary div/span wrappers. |
This works for me. Replacing the most outer div with the svg after injecting
|
It worked for me with change. Thanks a lot
|
Is it necessary to wrap SVG by 2 div elements in DOM? Maybe render only svg without div's or use only one wrapper element?
The text was updated successfully, but these errors were encountered: