Svg text according to the language to be used - html

How can I make the text I want to show differ according to the language used.
Example if the text is in:
Spanish I would like to use the text: Hola!
Italian I would like to use the text: Ciao!
English I would like to use the text: Hi!
If no language is passed, a default one, for example English.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg height="30" width="200">
<text x="0" y="15" fill="blue">Hi!</text>
</svg>
Example for language selection, the language could be on cookie or session.
Or it could be passed as a parameter to the file name.svg?Lang=es

You can use a switch element. Change your browser's language settings to prefer Italian or Spanish to see the text change.
<svg width="100%" height="100%" viewBox="0 100 600 300">
<switch font-size="18">
<g systemLanguage="en">
<text x="20" y="220" xml:lang="en-US">Why can't they just speak English ?</text>
<text x="230" y="150" xml:lang="en">English (US)</text>
</g>
<g systemLanguage="es">
<text x="20" y="220" xml:lang="es-ES" font-size="18">¿Por qué no pueden simplemente hablar en castellano ?</text>
<text x="230" y="150" xml:lang="en">Spanish (ES)</text>
</g>
<g systemLanguage="it">
<text x="20" y="220" xml:lang="it" font-size="18">Perchè non possono semplicemente parlare italiano ?</text>
<text x="230" y="150" xml:lang="en">Italian</text>
</g>
</switch>
</svg>

In modern Browsers you can use a Custom Element to dynamically generate the SVG
Use Roberts systemLanguage to enhance the SVG
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/systemLanguage
For React you have to add extra wrapper code around every Custom Element,
React only supports this W3C standard for 71%,
all other Frameworks are 100% BFF with the W3C standard Custom Elements API
customElements.define('svg-text', class extends HTMLElement {
static get observedAttributes() {
return ["bgfill", "width", "height", "stroke", "fill", "text",
"x", "y", "fontsize", "rotate"
]; // update whenever these attributes change
}
connectedCallback() {
let [bgfill = "pink", width = 200, height = 150, stroke = "none", fill = "green",
text = "Hello", x = "50%", y = "50%", fontsize = "1em", rotate = "0"
] = this.constructor.observedAttributes.map(x => this.getAttribute(x) || undefined);
this.innerHTML = `<svg width='${width}' height='${height}'` +
`xmlns='http://www.w3.org/2000/svg'>` +
`<rect width='100%' height='100%' fill='${bgfill}'/>` +
`<text dominant-baseline='middle' text-anchor='middle' font-size='${fontsize}'` +
` x='${x}' y='${y}' fill='${fill}' ` +
` stroke='${stroke}' transform='rotate(${rotate} ${width/2} ${height/2})'>${text}</text></svg>`
}
attributeChangedCallback(name, oldValue, newValue) {
if (this.isConnected) this.connectedCallback();
}
});
// example changing attribute
setTimeout(() => {
document.querySelector("svg-text").setAttribute("text", "Ola!");
}, 21e2)
<svg-text bgfill='lightblue' fill="blue" width="100" fontsize="3em" height="100">
</svg-text>
<svg-text fill="green" width="75" height="25" text="Hallo">
</svg-text>
<svg-text bgfill="gold" fill="red" width="50" text="Bonjour" rotate="90" fontsize="2em">
</svg-text>

Related

How can I display an SVG fill before image loads?

I currently have a working example, but I'm wondering if there's someone out there with more knowledge on SVGs than myself who can compress the code and make it more elegant.
What I'm trying to do:
Show image inside the custom defined path (shape) once page is loaded ("lazy load")
Until page load (on slower devices most importantly) show a fill as background.
See the fiddle and code here:
https://jsfiddle.net/k2o9L6dg/
Replicate the issue
All is working fine as you can see, but I would like to remove the <g> tag. If I remove this tag, the shape is transparent/white until the image loads. You can throttle under the "Network" tab to see this user experience. I would like to use a grey fill until image loads, so text can be displayed within the shape.
I feel like it should be possible to make this work, without having to define the "path" two times. Whenever I change the fill on the mask path to other than white, nothing appears at all (no idea why this happens).
I would like to be able to compress the code to just this:
<div class="vector">
<svg xmlns="http://www.w3.org/2000/svg" image-rendering="optimizeQuality" viewBox="0 0 510 360" shape-rendering="geometricPrecision" fill-rule="evenodd">
<defs>
<mask id="bg-c" maskContentUnits="objectBoundingBox">
<path fill="white" transform="scale(0.001965, 0.002800)" d="M148.500 3.099 C 113.488 6.747,84.700 13.892,62.351 24.482 C 43.108 33.600,33.681 41.189,22.444 56.609 C 7.759 76.760,4.338 86.781,5.282 106.890 C 5.880 119.655,7.968 128.762,13.637 143.340 C 23.834 169.561,23.443 167.883,23.464 185.500 C 23.479 197.898,23.041 203.414,21.520 210.000 C 18.603 222.635,18.745 240.097,21.847 249.975 C 30.657 278.033,52.991 299.700,93.500 319.490 C 109.905 327.505,121.171 331.756,142.440 337.958 C 190.118 351.861,258.762 358.886,289.318 352.989 C 307.253 349.528,331.710 340.925,364.262 326.626 C 392.030 314.428,408.965 308.298,425.480 304.468 C 451.051 298.538,471.322 283.403,481.509 262.633 C 487.363 250.696,489.054 243.962,489.701 230.000 C 490.547 211.754,486.958 197.061,477.358 179.483 C 469.662 165.389,471.689 154.395,491.588 102.309 C 506.590 63.041,509.743 48.582,505.331 39.285 C 501.149 30.471,482.609 22.301,459.167 18.940 C 445.334 16.957,405.463 18.286,371.500 21.862 C 319.125 27.376,299.077 27.919,277.500 24.407 C 270.080 23.199,265.779 21.647,253.000 15.566 C 234.292 6.663,230.109 5.365,214.006 3.470 C 200.434 1.873,162.341 1.658,148.500 3.099">
</path>
</mask>
</defs>
<image loading="lazy" data-href="https://images.pexels.com/photos/910411/pexels-photo-910411.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" alt="" width="100%" height="100%" mask="url(#bg-c)" preserveAspectRatio="xMidYMid slice">
</image>
</svg>
</div>
You can avoid duplicate <path> elements by creating a reusable definition in <defs>.
<defs>
<path id="maskPath" d="..." />
</defs>
Note: your reusable path definition must not contain any fill property if you need to change it's fill for different instances (like mask and background shape)
Your mask would look something like this:
<mask id="bg-c" >
<use href="#maskPath" fill="white" />
</mask>
Example
//emulate loading by setTimeout delay
emulateLazyLoad();
function emulateLazyLoad() {
let lazyImages = document.querySelectorAll('[loading="lazy"]');
lazyImages.forEach(function(lazy) {
let imgHref = lazy.dataset.href;
setTimeout(function() {
if (lazy.nodeName.toLowerCase() == "image") {
lazy.setAttribute("href", imgHref);
} else {
lazy.src = imgHref;
}
lazy.classList.replace("loading", "loaded");
}, 1000);
});
}
svg {
width: 50%;
display: inline-block;
}
.image {
transition: 0.3s opacity;
}
.loading {
opacity: 0;
}
.loaded {
opacity: 1;
}
<div class="vector">
<svg xmlns="http://www.w3.org/2000/svg" image-rendering="optimizeQuality" viewBox="0 0 510 360" shape-rendering="geometricPrecision" fill-rule="evenodd">
<defs>
<path id="maskPath" d="M148.500 3.099 C113.488 6.747,84.700 13.892,62.351 24.482 C 43.108 33.600,33.681 41.189,22.444 56.609 C 7.759 76.760,4.338 86.781,5.282 106.890 C 5.880 119.655,7.968 128.762,13.637 143.340 C 23.834 169.561,23.443 167.883,23.464 185.500 C23.479 197.898,23.041 203.414,21.520 210.000 C 18.603 222.635,18.745 240.097,21.847 249.975 C 30.657 278.033,52.991 299.700,93.500 319.490 C109.905 327.505,121.171 331.756,142.440 337.958 C 190.118 351.861,258.762 358.886,289.318 352.989 C 307.253 349.528,331.710 340.925,364.262 326.626 C392.030 314.428,408.965 308.298,425.480 304.468 C 451.051 298.538,471.322 283.403,481.509 262.633 C 487.363 250.696,489.054 243.962,489.701 230.000 C490.547 211.754,486.958 197.061,477.358 179.483 C 469.662 165.389,471.689 154.395,491.588 102.309 C 506.590 63.041,509.743 48.582,505.331 39.285 C501.149 30.471,482.609 22.301,459.167 18.940 C 445.334 16.957,405.463 18.286,371.500 21.862 C 319.125 27.376,299.077 27.919,277.500 24.407 C 270.080 23.199,265.779 21.647,253.000 15.566 C 234.292 6.663,230.109 5.365,214.006 3.470 C 200.434 1.873,162.341 1.658,148.500 3.099" />
<mask id="bg-c">
<use href="#maskPath" fill="white" />
</mask>
</defs>
<use id="bgShape" href="#maskPath" fill="gray" />
<text x="50%" y="50%" text-anchor="middle" dominant-baseline="middle">Loading ...</text>
<image class="image loading" loading="lazy" data-href="https://images.pexels.com/photos/910411/pexels-photo-910411.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" alt="" width="100%" height="100%" mask="url(#bg-c)" preserveAspectRatio="xMidYMid slice" />
</svg>
</div>
Place another <use>instance of your blob shape to create a background element like so:
<use id="bgShape" href="#maskPath" fill="gray" />
<text x="50%" y="50%" text-anchor="middle" dominant-baseline="middle">Loading ...</text>
<image class="image loading" loading="lazy" data-href="https://images.pexels.com/photos/910411/pexels-photo-910411.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" alt="" width="100%" height="100%" mask="url(#bg-c)" preserveAspectRatio="xMidYMid slice" />

Show multiple svgs in single img tag

I have 4 svgs. I would like to show 4 svgs as single <img>, which means let's say image has 4 equal parts, the 1st part has 1 svg and the 2nd part of the img tag has 2nd svg and so on...
4 svg ex:
<svg width="488px" height="531px">....</svg>
<svg width="350px" height="455px">....</svg>
<svg width="560px" height="620px">....</svg>
<svg width="395px" height="421px">....</svg>
<img src= SHOULD BE BELOW IMAGE/>
Like the comments said; combine them in one SVG
You can automate that.
Create your own <svg-grid> Web Component (supported in all modern browsers)
<svg-grid>
<svg width="48px" height="53px"></svg>
<svg width="65px" height="45px"></svg>
<svg width="56px" height="32px"></svg>
<svg width="39px" height="42px"></svg>
</svg-grid>
The Component reads all 4 SVG cildren
records the width/height
records its outerHTML
calculates the width/height needed for compiled SVG
creates that new SVG
adds the 4 SVGs calculating translate positions so they all align around the middle
overwrites the <svg-grid> innerHTML with the created IMG
All code required to output:
<script>
customElements.define('svg-grid', class extends HTMLElement {
connectedCallback() {
setTimeout(() => { // make sure all DOM SVG children are parsed
let colors = ["red", "green", "gold", "blue", "purple"];
let rect = i => `<rect width='100%' height='100%' fill='${colors[i]}'></rect>`;
let sizes = [];
let svgs = [...this.querySelectorAll("svg")].map((svg, idx) => {
svg.innerHTML = rect(idx) // rect color for testing only
sizes.push({
width: svg.width.baseVal.value,
height: svg.height.baseVal.value,
});
return svg.outerHTML;
});
let max = (x, y, wh) => Math.max(sizes[x][wh], sizes[y][wh]);
let c1w = max(0, 2, "width"); // column1width
let c2w = max(1, 3, "width"); // column2width
let r1h = max(0, 1, "height"); // row1height
let r2h = max(2, 3, "height"); // row2height
let grect = (nr,x,y) => `<g transform='translate(${x} ${y})'>${svgs[nr]}</g>`;
let svg = `<svg width='${c1w+c2w}' height='${r1h+r2h}' xmlns='http://www.w3.org/2000/svg'>` +
rect(4) + // extra background rect
grect( 0 , c1w-sizes[0].width , r1h-sizes[0].height ) +
grect( 1 , c1w , r1h-sizes[1].height ) +
grect( 2 , c1w-sizes[2].width , r1h ) +
grect( 3 , c1w , r1h ) +
`</svg>`;
// this.innerHTML = svg; // if you want the bare SVG
this.innerHTML = `<img src="data:image/svg+xml,${svg.replace(/"/g,"'").replace(/#/g, '%23')}">`;
})
}
});
</script>
<style> svg-grid img{ width:260px } </style>
<svg-grid>
<svg width="48px" height="53px"></svg>
<svg width="65px" height="45px"></svg>
<svg width="56px" height="32px"></svg>
<svg width="39px" height="42px"></svg>
</svg-grid>
<svg width="500" height="500">
<image x="20" y="20" width="100" height="100"
xlink:href='data:image/svg+xml,<svg width="100" height="100" version="1.1" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="50" fill="rgb(255,0,0)"/></svg>' />
<image x="100" y="20" width="100" height="100"
xlink:href='data:image/svg+xml,<svg width="100" height="100" version="1.1" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="50" fill="rgb(255,255,0)"/></svg>' />
<image x="20" y="100" width="100" height="100"
xlink:href='data:image/svg+xml,<svg width="100" height="100" version="1.1" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="50" fill="rgb(0,255,0)"/></svg>' />
<image x="100" y="100" width="100" height="100"
xlink:href='data:image/svg+xml,<svg width="100" height="100" version="1.1" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="50" fill="rgb(0,255,255)"/></svg>' />
</svg>
<image ... xlink:href='data:image/svg+xml,svg1 string.../>
<image ... xlink:href='data:image/svg+xml,svg2 string.../>
...
result url: https://stackblitz.com/edit/js-ryh4kb?file=index.html

SVG grid overlaid image

I'm not even sure how to explain this.
I have a floor layout that is in a JPG format, I would like to enable user to mouseOver or click on different area of the map to get dynamically information about it. To get different area of the map interactive, I was thinking I could overlaid a dynamically SVG grid on top/or behind it, that way, I can assign the dynamic data to a grid coordinates.
I am having problem with implementing this, I can't get the grid and the image to resize with each other. Also, since the SVG grid is dynamic, when the image is bigger, by default, the my grid has more lines which throws the coordinates off when zoom in/out.
Is there away to generate a fixed grid (e.g., 20x10) matched and overlaid it to the image. Make it zoom with the image? I just got started with SVG today so any help would be greatly appreciated.
Code in Angular2
<svg attr.width="{{w}}" attr.height="{{h}}" id="mySVG">
<image xlink:href="../asset/building.jpg" x="0" y="0" height="100%" width="100%"/>
<rect x="0" y="0" attr.width="{{w}}" attr.height="{{h}}" stroke="black" fill="url(#GridPattern)" stroke-width="5"
class="hello"/>
<defs>
<pattern id="GridPattern" x="0" y="0" attr.width="{{wGap}}" attr.height="{{hGap}}" patternUnits="userSpaceOnUse">
<line x1="0" y1="0" attr.x2="{{wGap}}" y2="0" stroke="lightblue" stroke-width="1px" />
<line x1="0" y1="0" x2="0" attr.y2="{{hGap}}" stroke="lightblue" stroke-width="1px" />
</pattern>
</defs>
<g id="group1" fill="red">
<!--<rect x="1cm" y="1cm" width="1cm" height="1cm"/>
<rect x="3cm" y="1cm" width="1cm" height="1cm"/>-->
<text *ngFor="let h of loc" attr.x="{{h.x*wGap}}" attr.y="{{h.y*hGap}}" fill="red" text-anchor='middle'>{{h.text}},h:{{h.y*hGap}},w:{{h.x*wGap}}</text>
<text *ngFor="let x of xNum; let i = index" attr.x="{{i*wGap}}" y="20" fill="red" style="writing-mode: tb; glyph-orientation-vertical: 0;
letter-spacing: -3;" >{{i}}</text>
<text *ngFor="let x of yNum; let i = index" x="20" attr.y="{{i*hGap}}" fill="red">{{i}}</text>
</g>
</svg>
import {Component, OnInit,NgZone} from '#angular/core';
#Component({
selector: 'home',
template: require('./home.html')
})
export class Home implements OnInit{
bol:boolean = true;
w:number;
h:number;
wGap:number;
hGap:number;
hMultiplier:number = 30;
wMultiplier:number = 40;
yNum = new Array(this.hMultiplier);
xNum = new Array(this.wMultiplier);
hLine:any;
wLine:any;
loc:Object[] = [{x:37,y:3,text:"testing 1"},
{x:31,y:25,text:"testing 2"},
{x:2,y:9,text:"testing 3"},
{x:35,y:8,text:"testing 4"},
{x:22,y:10,text:"testing 5"}]
constructor(ngZone:NgZone){
console.log(this.xNum,this.yNum)
console.log(window.innerHeight, window.innerWidth);
this.w = window.innerWidth-50;
this.h = window.innerHeight-200;
this.wGap = Math.ceil(this.w/this.wMultiplier);
this.hGap = Math.ceil(this.h/this.hMultiplier);
//////
//this.calculateLocation();
window.onresize = (e)=>{
ngZone.run(()=>{
console.log(window.innerWidth,window.innerHeight);
//this.w = document.getElementById('bldImg')['width'];
//this.h = document.getElementById('bldImg')['height'];
this.w = window.innerWidth-50;
this.h = window.innerHeight-200;
this.wGap = Math.ceil(this.w/this.wGap);
this.hGap = Math.ceil(this.h/this.hGap);
//////
// this.calculateLocation();
console.log(this.wGap)
console.log(this.hGap)
});
}
}
ngOnInit(){
}
}
I managed to do it using svg tag and create my own interactive map using Angular version 4 you can view the plnkr in this link - Please view the code
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 2000 800">
<svg:path
*ngFor="let country of countries; let i = index"
[attr.data-index]="i"
(mouseover)="countryHover = country.country_country"
(click)="clicked(i)"
class="blob"
[class.selected]="hasCountry(i)"
[attr.d]="country.country_path"
fill="currentColor">
</svg:path>
</svg>
Image of the Output incase if Plunker doesnt work
https://plnkr.co/edit/2heVmd7l4UokqR2OcNgm?p=preview

React - html tags inside svg

I am making circle menu, so I use SVG to create a circle, and now I want to show a link with some image inside of part of the circle. How i can do it? My code -
render(){
return(
<svg id={"menuLevel" + index} width={200} height={200}>
<path fill="white" stroke="rgba(0,0,0,0.2)" strokeWidth="2" d={"M"+width+","+width+" L"+previousX+", "+previousY+" A"+width+","+width+" 0 0,0 "+x+", "+y+" z"}></path>
</svg>
)
}
I tried something like this -
<path fill="white" stroke="rgba(0,0,0,0.2)" strokeWidth="2" d={"M"+width+","+width+" L"+previousX+", "+previousY+" A"+width+","+width+" 0 0,0 "+x+", "+y+" z"}>
<foreignobject x="120" y="120" width="180" height="180">
<Link ...><Image .../></Link>
</foreignobject>
</path>
But it doesn't work, this foreign object have still 0 width and 0 height and content doesn't show.
UPDATE
I need to assign link component to all path objects
<svg id={"menuLevel" + index} width={width*2+2} height={width*2+2}>
{arr.map(function(item){
let angleInRadians = -item * Math.PI / 180.0;
let previousX = x;
let previousY = y;
x = width + width * Math.cos(angleInRadians);
y = width + width * Math.sin(angleInRadians);
return(
<path fill="white" stroke="rgba(0,0,0,0.2)" strokeWidth="2" d={"M"+width+","+width+" L"+previousX+", "+previousY+" A"+width+","+width+" 0 0,0 "+x+", "+y+" z"}>
</path>
)
})}
</svg>
Please check it here JSFiddle. Use image element to add the image to SVG: https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_Image_Tag
<svg width="5cm" height="4cm" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink= "http://www.w3.org/1999/xlink">
<circle x="0" y="0" r="200"></circle>
<image xlink:href="https://www.google.co.uk/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" x="0" y="0" height="200px" width="200px"/>
</svg>
Please note:
If you do not set the x or y attributes, they will be set to 0.
If you do not set the height or width attributes, they will be set to 0.
Having a height or width attribute of 0 will disable rendering of the image.
Update 1
Here is a working example to add a React component together with the image: JSFiddle. But I make the Link component as a sibling of the SVG, and then using absolute to position them. Not a perfect solution.
Update 2
To make a path clickable: JSFiddle.
Update 3
This is an image with clickable paths, integrated with ReactJS: JSFiddle:
var Link = React.createClass({
render: function() {
return <a className="link" href={this.props.href} target="_blank">{this.props.children}</a>
}
});
var Hello = React.createClass({
render: function() {
return <div id="container"><svg xmlns="http://www.w3.org/2000/svg" width="300px" height="300px">
<Link href="http://www.google.com">
<g transform="translate(100, 100)"><image href="https://www.google.co.uk/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" x="0" y="0" height="200px" width="200px"/></g>
</Link>
<Link href="http://www.facebook.com">
<g><image href="https://www.facebook.com/images/fb_icon_325x325.png" x="0" y="0" height="100px" width="100px"/></g>
</Link>
</svg></div>
}
});

How to place two <g> side by side in an svg?

Hello all I am new to html5 and svg tag.I want to ask a question about svg html element.
Here is my code
<html>
<div>
<svg width = "1335" height = "400">
// I want to have two svg:g side by side one of more width and second of less width
such that width of svg = first g + second g
<g>
// All the elements inside g should have same width as g
</g>
<g>
</g>
</svg>
<div>
</html>
I have tried it using transform.But failed.
Is it possible to have two g elements side by side as I can't set x and y of g ?
Can any one guide me of doingthis another way.
You can use a transform, the problem then is how to get such values that make the transformed g at the right place. A possible way (the simplest, really) is to get the difference between coordinates of bounding boxes. Say you have a bounding box BB1 for group G1 and BB2 for G2, you could compute a translation to be applied to G2.
Of course we need a script to do that computation runtime. Such script will use
var BB1 = document.getElementById("G1").getBBox()
Here the code
<svg>
<script>
function align(evt) {
var G1 = document.getElementById("G1")
var G2 = document.getElementById("G2")
var BB1 = G1.getBBox()
var BB2 = G2.getBBox()
G2.setAttribute("transform", "translate("+ ((BB1.x+BB1.width)-BB2.x) + " " + ((BB1.y+BB1.height)-BB2.y) + ")")
}
</script>
<g id="G1">
<rect fill="red" x="10" y="10" width="40" height="30" />
</g>
<g id="G2" onclick="align(evt)">
<rect fill="blue" x="70" y="60" width="100" height="50" />
</g>
</svg>
you can experiment on jsFiddle with it
The <g> element doesn't have a position or a size, that's why you can't set x and y, it's just a logical container. Also SVG doesn't really have concept of layout in the same way as HTML does, which is what it looks like you're trying to achieve. If you want two elements next to each other, just draw them next to each other:
<svg width = "1335" height = "400">
<rect x="0" y="0" width="667" height="400" fill="#0f0"/>
<rect x="668" y="0" width="667" height="400" fill="#00f"/>
</svg>
If you just enclose each <g> in a separate SVG tag, and then close the set of SVG fragments within a <section> tag, the renderings with lay out just like images...flowing to the right and wrapping for me and my CSS--I can disect the CSS to figure out how/why if you really need that.
the simple example of how to do Irish flag by SVG
<!DOCTYPE html>
<html>
<body>
<h1>Irish Flag SVG image</h1>
<svg version="1.1"
baseprofile="full"
width="300" height="200"
xmlns="http://www.w3.org/2000/svg">
<!--creating rect side by side for irish flag -->
<rect x="0" y="0" width="300" height="200" fill="green"/>
<rect x="100" y="0" width="300" height="400" fill="white"/>
<rect x="200" y="0" width="300" height="400" fill="orange"/>
</svg>
</body>
</html>