LoginSignup
0
0

More than 1 year has passed since last update.

馬鹿の一つ覚え: SVG

Last updated at Posted at 2019-02-12

SVGの書き方

<?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の書き方 -->

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

  <circle cx="70" cy="64" r="50" fill="black" />
  <circle cx="180" cy="64" r="50" fill="gray" />

</svg>

SVGをHTML5の中に書き込む

  <img src="./graphics/bar.svg" alt="bar">

画像のサイズを指定

<svg width="640" height="480" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http:ww.w3.org/1999/xlink">
  <line x1="4" y1="472" x2="633" y2="7" stroke="darkgreen" stroke-width="5"/>
</svg>

矩形

  <rect x="32" y="64" width="320" height="240" fill="deeppink" stroke="none" />
  <rect x="370" y="64" width="160" height="40" fill="none" stroke="darkslateblue" stroke-width="4" />

文字列

  <text x="12" y="32" font-family="Arial" font-size="23" fill="darkslategray">文字列</text>

楕円

  <ellipse cx="80" cy="80" rx="50" ry="30" stroke-width="3" stroke="black" fill="none" />
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0