Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda