Check out example codes for "width defined by content css". It will help you in understanding the concepts better.

Code Example 1

/* <length> values */
width: 300px;
width: 25em;

/* <percentage> value */
width: 75%;

/* Keyword values */
width: max-content;
width: min-content;
width: fit-content(20em);
width: auto;

/* Global values */
width: inherit;
width: initial;
width: unset;

Learn ReactJs, React Native from akashmittal.com