javascript - CSS Styling fill space left in the left of the element and the right of the element -


imagine element, centered in container, has width, don't know exact width, text , want left space , right space same , colored, this:

----------------- test -----------------

#left {    background-color: red;  }  #middle {    width: 200px;    /* might different */  }  #right {    background-color: red;  }
<div id="left"></div>  <div id="middle"></div>  <div id="right"></div>

    .container{        display:flex;     }      .main-body{        flex:1 1 auto;     }     #left{         background-color: red;    }    #middle{         width: 200px;        text-align:center;   }     #right{         background-color: red;     }   <div class="container">     <div class="main-body" id="left"></div>     <div id="middle">hello</div>     <div  class="main-body" id="right"></div>   </div> 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -