简体   繁体   中英

CSS is there a better shorthand version for border?

Is there another shorthand version for border, something like this example:

        [top,right,bottom,left, style, color] 
border: 1px 1px 0px 1px solid #000;

I'm trying to accomplish the effect similar to this:

border: 1px solid #000;
border-bottom: 0;

Thanks in advance!

The spec says:

Unlike the shorthand 'margin' and 'padding' properties, the 'border' property cannot set different values on the four borders. To do so, one or more of the other border properties must be used.

Your way of doing it with two properties is probably the shortest way. Just go with that.

If you wish to have a border on all sides except the bottom, I think your method is the best to use for standard CSS

I don't believe there is a more shorthand method of doing this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM