css - outline 可以只设置一条边吗?
怪我咯
怪我咯 2017-04-17 11:36:43
0
8
606

outline 可以只设置一条边吗?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(8)
Peter_Zhu

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

Peter_Zhu

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

Peter_Zhu

You can use the border attribute to achieve similar effects

PHPzhong

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=

PHPzhong

No, try outline:solid

大家讲道理

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

黄舟

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

黄舟

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template