html - Div table cells do not have the same width -


the widths uneven table cells defined inside table, cant figure out why? apologies bad coding practice

fiddle:jsfiddle link

this html. table desfined in div class="mainstuff"

<body> <div id="maincontainer">     <div class="topbar">         <div class="logo">             codeplayer         </div>         <div class="tabs">             <ul>                 <li class="l">html</li>                 <li class="l1">css</li>                 <li class="l2">js</li>                 <li class="l3">result</li>             </ul>         </div>         <div class="run">             <button id="but">run</button>         </div>     </div>     <div class="clear"></div>      <div class="mainstuff">         <div class="row">             <div class="html">html</div>             <div class="css">css</div>             <div class="js">js</div>             <div class="result">result</div>         </div>     </div> </div>  </body>  </html> 

this related css.

  .topbar {     background-color: #d0d5db;     width: 100%;     height: 40px;     border-bottom-width: thick; } body {     margin: 0;     padding: 0; } .logo {     font-size: 1.8em;     font-weight: bold;     padding: 3px 2px;     float: left; } .run {     float: right;     margin-top: -5px;     padding: 6px 2px; } #but {     padding-left: 15px;     border-radius: 5px; } button { } ul {     list-style: none;     margin: 0; } .tabs {     margin: 0 auto;     width: 240px;     padding-top: 5px; } .l {     float: left;     border-color: #808080;     border-style: solid;     margin: 3px; } li:hover {     background-color: #808081; } .clear {     clear: both; } .mainstuff {     display: table;     width: 100%; } .html {     display: table-cell;     height: 100vh;     margin: 0;     background-color: red; } .css {     display: table-cell;     height: 100vh;     margin: 0;     background-color: yellow; } .js {     display: table-cell;     height: 100vh;     margin: 0;     background-color: blue; } .result {     display: table-cell;     height: 100vh;     margin: 0;     width: auto;     background-color: green; } .l1 {     float: left;     border-color: #808080;     border-style: solid;     margin: 3px; } .l2 {     float: left;     border-color: #808080;     border-style: solid;     margin: 3px; } .l3 {     float: left;     border-color: #808080;     border-style: solid;     margin: 3px; } .row {     display: table-row; } 

use table-layout:fixed table.

.mainstuff { display: table; width: 100%; table-layout:fixed; } 

demo


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -