Jump to content

Recommended Posts

When exporting to SVG, is it possible to get HTML5 output without putting every property into styles?

 

Example:

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 300 57" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
  
  <rect x="78.614" y="8.716" width="220.68" height="14" style="fill:#e0e0e0;"/>
  
  <ellipse cx="28.992" cy="28.132" rx="24.492" ry="23.632" style="fill:none;stroke:#e0e0e0;stroke-width:9px;"/>
  
</svg>

According to https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute#Core_attributes this can be written like this (looking only at the rect and ellipse):

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 300 57" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
  
  <rect x="78.614" y="8.716" width="220.68" height="14" fill="#e0e0e0"/>
  
  <ellipse cx="28.992" cy="28.132" rx="24.492" ry="23.632" fill="none" stroke="#e0e0e0" stroke-width="9px" />

</svg>

In my opinion this a more modern and cleaner way of writing SVG.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please note the Annual Company Closure section in the Terms of Use. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.