简体   繁体   English

CSS Outset/Inset、边框和轮廓

[英]CSS Outset/Inset, border and outline

What is exact difference between CSS outset,inset,border and outline . CSS outset,inset,border and outline之间的确切区别是什么。
Really confused about this , and what properties can be applied together.?真的很困惑这个,什么属性可以一起应用。?
Which browsers support which of the above properties ?哪些浏览器支持上述哪些属性?
Short example on above properties will be good.关于上述属性的简短示例会很好。

Thanks谢谢

Border and outline differences边框和轮廓差异

Border: The border edge surrounds the box border.边框:边框边缘围绕框边框。 Its area counts the total size of the box model.它的面积计算盒子模型的总大小。 You can specify size ( border-width ), color ( border-color ) and style ( border-style ) for each of the four possible borders (top, right, bottom and left).您可以为四种可能的边框(顶部、右侧、底部和左侧)中的每一个指定大小 ( border-width )、颜色 ( border-color ) 和样式 ( border-style )。 You can retrieve more info about border properties here .您可以在此处检索有关边框属性的更多信息。

Outline: Similar to border, but in this case do not take up space, opposite to border . Outline:类似于 border ,但在这种情况下不占用空间,与border相对。 Also, you can't style each border separately, the outline style applies to all the four sides of the box.此外,您不能单独设置每个边框的样式,轮廓样式适用于框的所有四个边。 Outline can be used together with border . Outline可以与border一起使用。 Properties you can apply to outline are outline-color , outline-style and outline-width You can get more info about outline properties here .您可以应用于轮廓的属性是outline-coloroutline-styleoutline-width您可以在此处获取有关轮廓属性的更多信息。

Here's a box model representing outline and border这是一个表示outlineborder的框模型在此处输入图片说明

Border-styles: inset and outset边框样式:插入和开始

Inset: It's a border-style .插图:这是一个边框样式 The border makes the box look as if it was embedded in the canvas.边框使框看起来好像嵌入在画布中。 You can use this border-style within border-color and border-width .您可以在border-colorborder-width使用此border-style

插入边框不同的浏览器

Outset: Another border-style .开始:另一种边框样式 The opposite of 'inset': The border makes the box look as if is coming out of the canvas. 'inset' 的反面:边框使框看起来好像是从画布中出来的。 You can use this border-style within border-color and border-width .您可以在border-colorborder-width使用此border-style

不同浏览器的起始边框

Documentation and sources文档和来源

these are a property of border这些是边界的属性

inset: Defines a 3D inset border.插图:定义 3D 插图边框。 The effect depends on the border-color value outset: Defines a 3D outset border.效果取决于边框颜色值起始:定义 3D 起始边界。 The effect depends on the border-color value outline: Set the outline around an element效果取决于边框颜色值轮廓:设置元素周围的轮廓

First answer is great answer.第一个答案是很好的答案。 wish we found this two months ago while starting out with html-dom..希望我们两个月前在开始使用 html-dom 时发现了这个。

Would just like to add: here the big difference is, border does not have an offset property (a "padding" of a "border" that does not affect the placement of elements) and outline cannot be made round with the -radius property.只想补充一点:这里最大的区别是, border没有offset属性(不影响元素放置的“边框”的“填充”)并且outline不能使用-radius属性变圆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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