File:T304209.svg
Summary
| Description | Test image applying style sheets (checks libsvg rendering). All items should look the same. View source for what works and what doesn't. | |||
| Date | ||||
| Source | Own work based on: Test only.svg | |||
| Author | H2g2bob | |||
| SVG development | Category:Valid SVG created with Inkscape:Examples#T304209.svg
|
Sorry, this SVG file is solely a source for re-utilization, editing or printing purposes. Please do not use this graphic within Wikipedia articles! MediaWiki isn't able to render this image correctly. Some details may be missing or look wrong. When you include the image in a Wikipedia or any other Wikimedia project site's page, you may want to use the other file, until the support increases.
File:T304209.svg
|
Category:Librsvg bug replaced by vector graphic#T304209.svg
Licensing
| I, the copyright holder of this work, release this work into the public domain. This applies worldwide. In some countries this may not be legally possible; if so: I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law. |
Tests
| Engine | 1 | 2 | 3 | 4 | 5 | 6 | Notes |
|---|---|---|---|---|---|---|---|
| MediaWiki (libsvg 2.40.16) | Yes | Yes | No | No | No | No | Cannot render descendant selectors, and using property "inherit" with other style classes fails. |
| Inkscape 0.45, 0.46 | Yes | Yes | No | Yes | Yes | Yes | In 3, misses rule for square class |
| KSVG 0.1 | Yes | No | No | No | No | No | Can't do style |
| Firefox (Iceweasel 2.0.0.6) | Yes | Yes | Yes | Yes | Yes | Yes | |
| Opera 9.64 | Yes | Yes | Yes | Yes | Yes | Yes | |
| Google Chrome 64 | Yes | Yes | Yes | Yes | Yes | Yes |
1 - Apply style directly
This method always works, and is the type automatically generated, eg: by Inkscape. Path is the circle, rect is the square.
<g> <path style="stroke-width: 2; fill: red;"> <rect style="stroke-width: 2; fill: blue;">
2 - Applying style to path and rect using a stylesheet
Uses the svg:style element to define style rules, as in a CSS stylesheet. Applies a "shape_direct" class to both shapes, and applied "square" class to the square to make it blue. "square" class uses !important to override shape_direct's red color.
<style> .shape_direct { stroke-width: 2; fill: red; } .square { fill: blue !important; } <g> <path class="shape_direct"> <rect class="shape_direct square">
3 - Style rules on inherited style classes
Same as 2, but replaces "shape_direct" class with the two classes "shape_under_group" and "group" as descendant-selectors.
<style> .group .shape_under_group { stroke-width: 2; fill: red; } .square { fill: blue !important; } <g class="group"> <path class="shape_under_group"> <rect class="shape_under_group square">
4 - Style rules on inherited style classes
Same as 3, but replaces "square" class with a rule looking for an item with the id "square_id" under any object of "group" class.
<style> .group .shape_under_group { stroke-width: 2; fill: red; } .group #square_id { fill: blue; } <g class="group"> <path class="shape_under_group"> <rect class="shape_under_group" id="square_id">
5 - Style rules applied to higher-level elements
Tests inheritance of style rules. In firefox and inkscape, applying a style to an element then applies that style to all child elements; others may apply default style sheets.
<style> .shape_direct { stroke-width: 2; fill: red; } .square { fill: blue !important; } <g class="group"> <path> <rect class="square">
6 - Force inherit
Same as 5, but explicitly requests inheritance.
<style> .shape_direct { stroke-width: 2; fill: red; } .square { fill: blue !important; } .force_inherit { fill: inherit; stroke: inherit; stroke-width: inherit; opacity: inherit; fill-opacity: inherit; } <g class="group"> <path class="force_inherit"> <rect class="force_inherit square">Category:Cascading Style Sheets Category:Examples representing SVG Category:Image detail for discussion Category:Pictures demonstrating a librsvg bug Category:Pictures showing a rendersvg bug - test suite
