anon
anon

Reputation:

box-sizing - 'outline' is calculated in 'border-box' OR 'content-box'?

When calculating width and height of the box, outline width like

outline: 5px dashed red;

if box-sizing:border-box, is outline will be considered in the width/height of the box ?

Upvotes: 4

Views: 3201

Answers (2)

Pons Purushothaman
Pons Purushothaman

Reputation: 2261

Outline property is independent of box-sizing and is not as part of width or height of the element. I generally used to stand out the element from the crowd.

Upvotes: 1

Jakub Muda
Jakub Muda

Reputation: 6734

I found a note about it on W3Schools HERE

It says: "Outline differs from borders! Unlike border, the outline is drawn outside the element's border, and may overlap other content. Also, the outline is NOT a part of the element's dimensions; the element's total width and height is not affected by the width of the outline."

When you set an outline it should NOT be affected by box-sizing setting and outline will be outside of the box.

Upvotes: 4

Related Questions