Skip to content
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

Make <style> element optional, or add an id? #91

Closed
benbell95 opened this issue Mar 6, 2018 · 1 comment · Fixed by #106
Closed

Make <style> element optional, or add an id? #91

benbell95 opened this issue Mar 6, 2018 · 1 comment · Fixed by #106

Comments

@benbell95
Copy link

benbell95 commented Mar 6, 2018

Currently in svglite, a svg file is created using the <style> element to set global styles for line, polyline, path, rect, circle.

While this works well for single svg files, if using multiple inline svgs on the same html page, the style element can override the styling for all other svgs on that page with undesirable results.

Is it possible to add an argument to the svglite function to make the use of <style> optional? something like style=TRUE/FALSE?

Alternatively, could id tags be added to the style code so it is only applied to that image? Perhaps an option to specify the id? e.g. id="svg1"

As a workaround, i enclose the svgs in my html pages within <div> tags and alter the style defs so styling is not applied globally e.g.

<div id="svg1">
<svg>
<defs>
  <style type='text/css'>
    #svg1 line, #svg1 polyline, #svg1 path, #svg1 rect, #svg1 circle {
      fill: none;
      stroke: #000000;
    }
  </style>
</defs>
svg here
</svg>
</div>
@jcubic
Copy link

jcubic commented May 31, 2019

This is anoying you can't have SVG that is not shiny GGPlot on the page because of this. CSS is applied to whole page. So you can't have SVG based logo in shiny app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants