LoginSignup
6
2

More than 5 years have passed since last update.

border-imageを使うときborder-radiusが効かない

Last updated at Posted at 2017-04-19

こんなふうに書く人多いと思うんですけど

button.css

#button { 
    border-image-source: linear-gradient(90deg, red, blue);
    border-radius: 15px;
}

これは効かないんですね
この下のように書けば、widthが1の丸角のボーダーが作れます

button.css

#button { 
    position: relative;
    background-color:white;
    border-radius: 15px;
}

#button::after {
    position: absolute;
    top: -1px; bottom: -1px;
    left: -1px; right: -1px;
    background: linear-gradient(90deg, red, blue);
    content: '';
    z-index: -1;
    border-radius: 16px;
}

6
2
1

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
6
2