html - CSS Imperfect Table Borders -
i have 2 tables layed out inline right side of table 1 touches left side of table 2, creating illusion 1 table.
the reason why on mobile device, tables displayed 1 under other users don't have scroll left-right while reading.
that said, cannot table borders display correctly:
as can see, intelligence value meets rank value, border thinner other cells no apparent reason. also, interior cell borders thicker outside border of 2 tables. thickness should 2px around table inside table.
can clarify me?
@media screen , (min-width: 769px) { table#statcontainer, table#statcontainer2 { display: inline-block; width: initial; } table#statcontainer, table#statcontainer2 { width: 50% !important; } } table#statcontainer, table#statcontainer2 { width: 100%; } table#statcontainer tr:first-child, table#statcontainer2 tr:first-child { font-weight: bold; } table#statcontainer, table#statcontainer2, tr#stat-header, tr#stat-header2, td.stats { vertical-align: middle; text-align: center; font-family: impact, charcoal, sans-serif; } td.stats { border: 1px solid #d03908; width: 78px; padding: 5px; } td.value { font-size: 30px; padding: 0; } td.stats p { margin: 0; } tr#stat-header, tr#stat-header2 { background: #d03908; /* browsers not support gradients */ background: -webkit-linear-gradient(#d03908, #fff); /* safari 5.1 6.0 */ background: -o-linear-gradient(#d03908, #fff); /* opera 11.1 12.0 */ background: -moz-linear-gradient(#d03908, #fff); /* firefox 3.6 15 */ background: linear-gradient(#d03908, #fff); /* standard syntax */ } .entry-content { float: left; }
<div class="entry-content"> <table id="statcontainer"> <tr id="stat-header" class="tablekey"> <td id="couragekey" class="stats"> <span><p>courage</p></span> </td> <td id="endurancekey" class="stats"> <span><p>endurance</p></span> </td> <td id="fireblastkey" class="stats"> <span><p>fireblast</p></span> </td> <td id="intelligencekey" class="stats"> <span><p>intelligence</p></span> </td> </tr> <tr id="stat-value" class="tablevalue"> <td id="couragevalue" class="stats value"> <p>10</p> </td> <td id="endurancevalue" class="stats value"> <p>10</p> </td> <td id="fireblastvalue" class="stats value"> <p>8</p> </td> <td id="intelligencevalue" class="stats value"> <p>10</p> </td> </tr> </table> <table id="statcontainer2"> <tr id="stat-header2" class="tablekey"> <td id="rankkey" class="stats noleftborder"> <span><p>rank</p></span> </td> <td id="skillkey" class="stats"> <span><p>skill</p></span> </td> <td id="speedkey" class="stats"> <span><p>speed</p></span> </td> <td id="strengthkey" class="stats"> <span><p>strength</p></span> </td> </tr> <tr id="stat-value2" class="tablevalue"> <td id="rankvalue" class="stats value noleftborder"> <p>10</p> </td> <td id="skillvalue" class="stats value"> <p>10</p> </td> <td id="speedvalue" class="stats value"> <p>8</p> </td> <td id="strengthvalue" class="stats value"> <p>10</p> </td> </tr> </table> </div>
js fiddle: http://jsfiddle.net/exmrf/424/
note in js fiddle, have opposite problem: border tables meet thicker other cells!
keep in mind borders add when placing tables next each other 2px + 2px = 4px
step 1: remove html don't need
step 2: simplify css , remove right border of left table when placed next eachother.
note have floated tables dont have hack closing , opening table tags together. may need apply clearfix div containing them though.
also note moving media query after tha main body of css don't need use !important
.entry-content table { border-collapse: collapse; width:100%; } .entry-content td, .entry-content th { border: 1px solid #d03908; width: 78px; padding: 5px; text-align:center; font-family: impact, charcoal, sans-serif; } .entry-content td { font-size: 30px; } thead { background: #d03908; /* browsers not support gradients */ background: -webkit-linear-gradient(#d03908, #fff); /* safari 5.1 6.0 */ background: -o-linear-gradient(#d03908, #fff); /* opera 11.1 12.0 */ background: -moz-linear-gradient(#d03908, #fff); /* firefox 3.6 15 */ background: linear-gradient(#d03908, #fff); /* standard syntax */ } @media screen , (min-width: 769px) { .entry-content table { width:50%; float:left; } #statcontainer tr td:last-child, #statcontainer tr th:last-child { border-right:none; } }
<div class="entry-content"> <table id="statcontainer"> <thead> <tr class="tablekey"> <th id="couragekey" class="stats"> courage </th> <th id="endurancekey" class="stats"> endurance </th> <th id="fireblastkey" class="stats"> fireblast </th> <th id="intelligencekey" class="stats"> strength </th> </tr> </thead> <tbody> <tr id="stat-value" class="tablevalue"> <td id="couragevalue" class="stats value"> 10 </td> <td id="endurancevalue" class="stats value"> 10 </td> <td id="fireblastvalue" class="stats value"> 8 </td> <td id="intelligencevalue" class="stats value"> 10 </td> </tr> </tbody> </table> <table id="statcontainer2"> <thead> <tr class="tablekey"> <th id="rankkey" class="stats noleftborder"> rank </th> <th id="skillkey" class="stats"> skill </th> <th id="speedkey" class="stats"> speed </th> <th id="strengthkey" class="stats"> strength </th> </tr> </thead> <tbody> <tr id="stat-value2" class="tablevalue"> <td id="rankvalue" class="stats value noleftborder"> 10 </td> <td id="skillvalue" class="stats value"> 10 </td> <td id="speedvalue" class="stats value"> 8 </td> <td id="strengthvalue" class="stats value"> 10 </td> </tr> </tbody> </table> </div>
Comments
Post a Comment