473,378 Members | 1,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Sizing SVG in HTML

Tom
Is there any way to show a SVG in a HTML in different sizes by changing
the
width and height attributes of the object/embed tag?

Assume a simple SVG like

<svg width="100" height="100">
<rect x="0" y="0" width="100" height="100"
style="fill:none;stroke:black"/>
<svg>

which is embeded in a HTML page like

<object type="image/svg+xml" data="simple.svg"
width="100" height="100">
<embed type="image/svg+xml" src="simple.svg"
width="100" height="100"></embed>
</object>

the SVG is always shown at size 100x100 no matter what I provide for
HTML width and height. Is there anything I can put into my SVG to make
it custom sizable?
I know I could write
<svg width="100%" height="100%">
<rect x="0%" y="0%" width="100%" height="100%"
style="fill:none;stroke:black"/>
<svg>
But that is not ok for me, except for the initial SVG width and height
attributes.

__
Tom

Sep 9 '05 #1
2 1190
Hi,

Tempore 14:06:28, die Friday 09 September 2005 AD, hinc in foro {comp.text.xml} scripsit Tom <ba***@b3s.de>:
Is there any way to show a SVG in a HTML in different sizes by changing
the
width and height attributes of the object/embed tag?


I'm not an expert on the topic of SVG, but I'll try to help.

Instead of specifying the width and height on the svg element, specify the viewBox:

<svg viewBox="0 0 100 100">
<rect x="0" y="0" width="100" height="100"
style="fill:none;stroke:black"/>
<svg>

Now you should be able to scale it via HTML syntax.

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Deserta faciunt et innovationem appelant
Sep 9 '05 #2
Tom
Yes! Thank you.

Sep 9 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sujith | last post by:
It will be great if any one helps me in sizing fonts in browser!!! I tried this code it worked in Konqueror but not in Mozilla I need a solution that will work in IE,Netscape,Mozilla etc.... ...
53
by: Andrew Poulos | last post by:
I've got some CSS that looks like this: body { margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 140.01%; color: #000000; } but IE won't apply the font size to text in table...
16
by: Axel Dahmen | last post by:
Hi, I always thought that "1em" equals one line height. But if I replace <br><hr><br> by <hr style="margin: 1em 0;">
2
by: bugbear | last post by:
Is there a current "best practice" for text sizing? My goal is a have a web page (web application actually) which looks the same (more or less) on Mac IE5, PC IE6, Mozilla, Konqueror and Safari....
5
by: BWIN | last post by:
I am the owner of a very large scale member-base website and the members are having trouble re-sizing there pics to create headshots. The headshots are supposed to be 175 x 175 pixels exactly. We...
11
by: N. Graves | last post by:
I have checked the "Alignment and Sizing" toolbar but when I want to use in on aligning several form object the toolbar buttons stay grayed out. What am I missing. Thanks! N. Graves
1
by: Tim Burda | last post by:
I am having some problems with getting an .gif file to display properly on an ASPX page. The image appears grainy and distorted. I have tried implementing the image (stored in several formats)...
3
by: reachmano | last post by:
Hello everyone: When I view my web-page on different computers, I am having trouble with re-sizing the screen on some of them. Was wondering what should be done differently to take care of the...
2
by: Logu Krishnan | last post by:
Hi, I'm looking out info on how to perform System Sizing and Capacity Planning for a product built using ASP.NET... is there any specifics ? any pointers to these will be highly appreciated. ...
21
by: Cartoper | last post by:
I am working on a browser kiosk needs to be able to be run at multiple screen resolutions. What I would like to do is keep the text the same size relative to the screen, all the time. In other...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.