Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
External CSS for SVG elements inside object tag

I have a svg with many rect element inside it and has been added to html using object tag. I need to write external css (just to change color on hover of rect elements) for all the rect elements. Able to achieve this if I write styles inside svg. But how to achieve the same with external css ?

sample.html

<object class="svg" id="show-svg" data="sample.svg" type="image/svg+xml"/>

sample.svg

<svg>
<style>
rect:hover {stroke: red !important}
</style>
<g>
<rect style=stroke:white width="82.020828"
         height="134.9375"
         x="13.229176"
         y="135.60417"
/>
<rect style=stroke:white width="82.020828"
         height="134.9375"
         x="13.229176"
         y="135.60417"
/>
</g>
</svg>

The above has css written inside svg and works fine. But would like to achieve the same by writing external css outside svg, how to do it ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!