search

Home  >  Q&A  >  body text

css - outline 可以只设置一条边吗?

outline 可以只设置一条边吗?

怪我咯怪我咯2782 days ago619

reply all(8)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 11:38:43

    Probably not possible. .
    The outline attribute only needs outline-width outline-style outline-color, and under webkit there is also outline-offset

    For this kind of problem, you can
    F12 to see what attributes are available
    You can also check MDN https://developer.mozilla.org/en-US/docs/Web/CSS/outline

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 11:38:43

    No. But you can put outline: none; and then set border to achieve that.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 11:38:43

    You can use the border attribute to achieve similar effects

    reply
    0
  • PHPz

    PHPz2017-04-17 11:38:43

    Of course not supported.

    Black magic time: You can use cropping to cut off the sides where the outline overflows...

    Crops include overflow:hidden, clip. There is also clip-path that is newer, but it seems that chrome has stopped supporting it.

    https://jsfiddle.net/4npvyfn8/3/

    Because it is black magic, it doesn’t matter if the code is beautiful or not=w=

    reply
    0
  • PHPz

    PHPz2017-04-17 11:38:43

    No, try outline:solid

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 11:38:43

    Outline looks very similar to border settings, but outline cannot declare the style of a single side like border.

    reply
    0
  • 黄舟

    黄舟2017-04-17 11:38:43

    In fact, you can wrap another layer of p outside the content and set a border.

    reply
    0
  • 黄舟

    黄舟2017-04-17 11:38:43

    You can use box-shadow to simulate
    https://jsfiddle.net/4npvyfn8/5/

    reply
    0
  • Cancelreply