CSS width issue

I have div C inside div B inside div A.

Div A has a width of 700px and div C has a width of 100px. Div B does not have a set width.

My problem is that div B extends its width to 100% (to fit the width of div A). Is there a way for div B, i.e. its width, to fit children divs? I want it to be wrapped around div C, and any other div that I set next to div C.

+3
source share
3 answers

It looks like you need a nonexistent float: center attribute. Check out this article for a workaround.

+3
source

:

#b {
  margin:0px auto;
  overflow:hidden;
  display:table;
}

.

+6

B div , .

<div id="B" style="float:left;">
+3

Source: https://habr.com/ru/post/1709690/


All Articles