LoginSignup
1
3

More than 5 years have passed since last update.

svgで線を描いてみる。

Posted at

四角い点線

サンプルコード
html,cssのみで記述しています。
hoverしたら、点線がぐるぐるまわります。

スクリーンショット 2015-05-28 20.07.56.png

html
<svg viewBox="0 0 200 200">
    <polygon points="20,20 20,100 120,100, 120,20"/>
</svg>
css
svg {
    stroke: #09d;
    stroke-width: 2;
    stroke-dashoffset: 0;
    stroke-dasharray: 5;
    fill: none;
    -webkit-transition: all 2s ease-in-out;
}

svg:hover {
    stroke-dashoffset: 100;
    stroke-width: 1;
    stroke-dasharray: 3;    
}
1
3
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
1
3