Search
 
SCRIPT & CODE EXAMPLE
 

CSS

* box-sizing border-box

*{
box-sizing: border-box;
}
Comment

box sizing border box

*{
 box-sizing: border-box;
 }
Comment

what happens when the width is 0 and there is a border and box-sizing is set to border-box?



The content area is anything left after you subtract the width of the border.

    | The content width and height are calculated by subtracting the border and padding widths of the respective sides from the specified ‘width’ and ‘height’ properties.

Specified width = 10 px
border width = 10 px
Content width = Specified width (10 px) - border width (10 px)
Content width 10 - 10 = 0

Specified width = 0 px
border width = 10 px
Content width = Specified width (0 px) - border width (10 px)
Content width 0 - 10 = -10 ( which would remove the 10 px used by the border)

But

    | As the content width and height cannot be negative ([CSS21], section 10.2), this computation is floored at 0.

Specified width = 0 px
border width = 10 px
Content width = Specified width (0 px) - border width (10 px)
Content width 0 - 10 = 0 ( which doesn't remove the 10 px used by the border)

If you don't want to use display:none; or visibility:hidden;, you need to set both the width:XX; and the border-right:XX; to zero.
Comment

PREVIOUS NEXT
Code Example
Css :: css colors 
Css :: css table grid 
Css :: style class css 
Css :: css custom underline color 
Css :: how to add bold in css 
Css :: linking in css 
Css :: content-visibility 
Css :: flex-grow css 
Css :: css after before 
Css :: switch checkbox 
Css :: gradient generator 
Css :: how to apply a transition to a child element when hovering over parent element 
Css :: mini.css 
Css :: jquery or selector 
Css :: WordPress Permalink for bread crumbs 
Css :: is there a min-left css attribute 
Css :: datefns get year 
Css :: html externe css einbinden 
Css :: request.env.cr.execute how to get the fetched data in dictionary 
Css :: password and re-password html css 
Css :: .quform-sub-label 
Css :: how to align text in css 
Css :: float pb 
Css :: css kommentar 
Css :: Creating Hashnode logo with CSS 
Css :: image with colored background html css tigether 
Css :: css debugger 
Css :: hide the default tooltip behaviour from safari 
Css :: javafx css rectangle outline 
Css :: backface-visibility sass 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =