Category:SVG simplification by grouping
Jump to navigation
Jump to search
Using some care to arrange elements with the same attributes may avoid to repeat their definition.
Such a structure collects the most used attributes into a group <g …>
, and specifies separately the other needed ("inner") attribute values; they may overwrite the predefined ("outer") group attribute values.
<g stroke="#000" stroke-width="3" stroke-linejoin="round" fill="#093">
<path stroke-width="5" ...
<g fill="#FFF">
<path ...
<path ... </g>
<path stroke="#F00" ...
</g>
- Since the implementation of Librsvg 2.37 in January 2013 it is also possible to declare attributes globally
- with the start tag
<svg ... >
instead of inserting a first<g>
line and closing it by</g>
. - Example:
<svg xmlns=... width="300" height="300" ...
fill="#FED" stroke="#000" stroke-width="12"
stroke-linecap="round" stroke-opacity=".4">
- This may often allow to keep the code leaner.
In general, a list of attributes can be written either
- stroke="#000" stroke-width="3" stroke-linejoin="round" fill="#093" opacity=".4"
or with the "style=" element
- style="stroke:#000;stroke-width:3;stroke-linejoin:round;fill:#093;opacity=.4"
It can easily be seen that with the style element the same number of bytes is needed for 4 attributes;
less attributes need less bytes without it, more than five need less bytes with it.
Media in category "SVG simplification by grouping"
The following 34 files are in this category, out of 34 total.
-
'Klaviatura' drawn by Ivan v. 3.svg 206 × 100; 922 bytes
-
0167 Othon, C. de Bentheim-Bentheim.svg 260 × 300; 597 bytes
-
1,3,5-Trioxane.svg 82 × 85; 331 bytes
-
20percentFB.svg 644 × 194; 1 KB
-
7360 pinout.svg 396 × 624; 3 KB
-
Acht-trigramme.svg 400 × 400; 1 KB
-
BSicon uPANAMACANAL-BASINSr.svg 500 × 500; 324 bytes
-
CampagneGuerreIndipendenza.svg 218 × 60; 353 bytes
-
Circle area Monte Carlo integration.svg 420 × 420; 4 KB
-
Color guide flags.svg 700 × 850; 2 KB
-
Commemorative Italian-Austrian war medal BAR.svg 218 × 60; 353 bytes
-
Construction sheet of Flag of the People's Republic of China.svg 900 × 600; 1 KB
-
EPP-EVP-Logo-German-2011.svg 794 × 387; 9 KB
-
Estelada roja vertical.svg 510 × 762; 291 bytes
-
Gerrymandering.svg 536 × 246; 804 bytes
-
Gluelebensdauerrp-de.svg 620 × 319; 3 KB
-
Graphic artist user icon.svg 400 × 400; 461 bytes
-
Idc34m.svg 400 × 100; 482 bytes
-
JMSDF Captain insignia (miniature).svg 106 × 177; 310 bytes
-
Korean consonants.svg 215 × 265; 1,010 bytes
-
Korean vowels.svg 220 × 220; 907 bytes
-
Wappen Massenbach.svg 500 × 588; 448 bytes
-
Montreal public transit icons - Métro.svg 512 × 512; 2 KB
-
MTR Exit I.svg 20 × 30; 177 bytes
-
Mute Icon.svg 500 × 500; 306 bytes
-
Pentominos.svg 1,120 × 700; 1 KB
-
Polit Workaround.svg 372 × 262; 8 KB
-
Blason Tavel (Gard).svg 600 × 660; 412 bytes
-
Blason Tavel (Gard) gradiented.svg 600 × 660; 749 bytes
-
The Noun Project logo.svg 160 × 160; 353 bytes
-
Wappen Filderstadt.svg 520 × 600; 504 bytes
-
Wappen Plochingen.svg 596 × 615; 509 bytes
-
Wien Wappen.svg 200 × 260; 697 bytes
-
Wikidata oversight.svg 890 × 540; 342 bytes