Leave fluid Ivs

Asked

Viewed 31 times

1

I have the following structure

<div id="container-header">
  <div class="center">

    <div class="content-header">content-header</div>
    <div class="thumb-header">thumb-header</div>

  </div>
</div>


div {width: 100%;}

.center {
   width: 71.42857142857143%;/*1200/1680*/
   margin: 0 auto;
}

.center > div {
   height: 120px;
   background-color: #ccc;
}

.content-header {width: 83.33333333333333%;/*1000/1200*/}

.thumb-header {width: 14.33333333333333%;/*172/1200*/}

outworking

inserir a descrição da imagem aqui

now when I lower the screen to div thumb-header loses its normal size, in which case it would have to make a media queries for each situation or there is another way?

inserir a descrição da imagem aqui

  • What you mean by "normal size", in fact her size is normal, she corresponds to the size you delimited 14.3% of the father’s width... the smaller the father, visually smaller the children get... What behavior you wanted them to have?

  • @hugocsl opa Hugo, type wanted the thumb-header accompanied the screen only to maintain the appearance of 14.3% got it? example http://prntscr.com/nwc4tj

1 answer

1


If I understand correctly you want it to be 14.3% wide, but you want it to respect a minimum width, for that you will have to use a min-width. For example if the screen is very wide the size is 14.3%, but if it is very small it will be at least 160px wide for example... And the right div you leave with flex:1 so she’ll just occupy the remaining space

inserir a descrição da imagem aqui

Follow the image code above.

div {border: 1px solid #000;}

.center {
    width: 71.42857142857143%;/*1200/1680*/
    margin: 0 auto;
    display: flex;
}

.center > div {
    height: 120px;
    background-color: #ccc;
}

.content-header {
  flex: 1;
  /* espaço entre uma div e outra */
  margin-right: 16px; 
  }

.thumb-header {
  width: 14.33333333333333%;/*172/1200*/
  min-width: 160px;
 }
<div id="container-header">
  <div class="center">

    <div class="content-header">content-header</div>
    <div class="thumb-header">thumb-header ratione rem consequatur.</div>

  </div>
</div>

  • as always saving my life

  • @goio No problem my dear []’s

Browser other questions tagged

You are not signed in. Login or sign up in order to post.