File:Test only.svg

Original file(SVG file, nominally 750 × 200 pixels, file size: 3 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary edit

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
Author H2g2bob
SVG development
InfoField
 
The SVG code is valid.
 
This vector image was created with Inkscape.
 
 This file uses embedded text that can be easily translated using a text editor.
A raster version of this image is available. It should be used in place of this vector image because of its superior quality.

In general, it is better to use a good SVG version.


Bitmap image
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.


Deutsch  English  español  italiano  日本語  한국어  македонски  português do Brasil  русский  sicilianu  slovenščina  简体中文  繁體中文  +/−

{{{svgImageLabel}}}

Licensing edit

Public domain 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 edit

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 edit

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 edit

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 edit

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 edit

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 edit

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 edit

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">

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:37, 11 April 2014Thumbnail for version as of 17:37, 11 April 2014750 × 200 (3 KB)Perhelion (talk | contribs)fix class, make inherit more show, Inkscape code removed
18:11, 29 August 2007Thumbnail for version as of 18:11, 29 August 2007800 × 300 (8 KB)H2g2bob (talk | contribs)minor error

File usage on other wikis

The following other wikis use this file:

Metadata