The problem of setting the minimum width of div with min-width

set the minimum width of the div with min-width to center the div, but always inherit the width of the parent element, so that the content is always displayed on the left. How can you not inherit the width of the parent element

Mar.20,2021

you can use inline-block to achieve content adaptation;
parent element directly text-align:center to center the child element of display:inline-block ;
child element to center the content through text-align:center ;
at this time, the child element div will not inherit the width of the parent element. If the
content is removed, it can be handled separately, but not handled here.
example


min-width means "minimum width", so if the parent element is wider, as a block element, it must be as wide as the parent element.

there are many options for centring layout. I don't know your specific needs. Please use this for the time being:

The
  

min-width property is not used to set the width.
under the default rule of document flow: block-level elements support the maximum width of a line in the document stream and inherit the width of their parents by default, while the width of inline elements is the width of their child elements (do not populate inline elements with block-level elements).
then you can change the width of the block-level element by changing the attributes of the block-level element, such as explicitly specifying width or detaching it from the document flow, such as float.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36824-2ad63.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36824-2ad63.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?