Set the width of children to fill the parent

后端 未结 7 1112
日久生厌
日久生厌 2020-12-19 11:46

I want the children of the div fill its width.

now am using a code like this:

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-19 12:32

    here is the code below , i think this may help for you

    	.parent {
      
      display: -webkit-flex; /* Safari */
      display: flex;
      height: 120px;
      background: #000;
      padding: 10px;
      box-sizing: border-box;
    }
    
    .child {
    
      -webkit-flex: 1;  /* Safari 6.1+ */
      -ms-flex: 1;  /* IE 10 */    
      flex: 1;
      margin-left: 1%;
      background: #ffffd;
    }


提交回复
热议问题