4 replies [Last post]
gautamz07
gautamz07's picture
Offline
Enthusiast
Last seen: 3 years 4 weeks ago
Timezone: GMT+5.5
Joined: 2014-04-24
Posts: 265
Points: 403

Hey gary ,

Hope everythings been fine on your end Smile i know that on one of my previous qiuestions you did mention that you personally do not use flex layout , but i have a very simple question about the property flex-basis, in the moz docs i see the following statement:

 This property determines the size of the content-box unless specified otherwise using box-sizing.

mozilla docs here https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis

what does the part "unless specified otherwise using box-sizing" mean i am not understanding that part really .. can you explain ?

Thank you.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 day 3 hours ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9743
Points: 3822

Content vs border box sizing

The content box (which is the default method) is a measure of the inside dimensions of the container. For example, if you make p {width: 10em;}, any padding and border are in addition making the outer dimension larger.

The border box, instead, declares the outer dimension and the border and padding dimensions are subtracted from the inner space.

See MDN box sizing, and CSS3 Basic User Interface Module, ยง3.1.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

gautamz07
gautamz07's picture
Offline
Enthusiast
Last seen: 3 years 4 weeks ago
Timezone: GMT+5.5
Joined: 2014-04-24
Posts: 265
Points: 403

LOL i knew that part ;P

Hey gary thanks i knew that part i was just wondering what the statement

This property determines the size of the content-box unless specified otherwise using box-sizing.

meant ? does it mean that if box-sizing is set to content-box ?

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 day 3 hours ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9743
Points: 3822

Oh,

It is simply saying that when specifying a flex-basis width, e.g. 10em, the content-box model will be used unless otherwise specified. So, if you want that width to include the padding and border, you will need to specify {box-model: border-box;}.

(Unless I'm completely wrong.) Why don't you test and let us know?

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

gautamz07
gautamz07's picture
Offline
Enthusiast
Last seen: 3 years 4 weeks ago
Timezone: GMT+5.5
Joined: 2014-04-24
Posts: 265
Points: 403

Thanks gary

Sure let me test it . it just sounded so complicated that i was't sure what that statement meant Tongue