Last active
December 28, 2017 10:35
-
-
Save micmro/2d3da8e6d4ac13687dca to your computer and use it in GitHub Desktop.
SVG with both fixed width (pixel) and flexible with (percentage) panels combined - https://jsfiddle.net/4xuLyvj9/ - does not work in IE/Edge due to lack of support for SVG in `foreignObject`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<svg width="100%" height="250" xmlns="http://www.w3.org/2000/svg"> | |
<foreignObject id="fixed-panel" width="100" height="100%"> | |
<svg width="100" xmlns="http://www.w3.org/2000/svg"> | |
<rect x="0" y="0" width="100" height="100%" fill="#fcc" rx="5" ry="5"/> | |
<text x="5%" y ="25" width="100" fill="#333">fixed width</text> | |
</svg> | |
</foreignObject> | |
<foreignObject id="flex-panel" width="100%" height="100%" style="padding-left:100px;"> | |
<svg width="100%" xmlns="http://www.w3.org/2000/svg"> | |
<rect x="0" y="0" width="100%" height="100%" rx="5" ry="5" fill="#cfc" /> | |
<text x="5%" y ="25" fill="#333">variable width</text> | |
</svg> | |
</foreignObject> | |
</svg> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you're ok to have the fixed with element in HTML you can get it working in MS Edge as well: https://jsfiddle.net/a12x9c56/10/