Hi, I've been learning more about pseudo styles in CSS, and I have a horizontal border in my table that normally I would have done with an hr tag. With an hr tag I could limit the width of the rule, but since I'm using border-top instead I'm not sure how to make it line up with the content that is above it. The gray line goes way past the text that is above it, I would like it to end aligned right with the text. Is there a way to do this without adding more HTML? Thanks!
In my CSS the line is:
Full code:Code:table#product thead th{border-top: 2px solid #D3D3D3; color: black; padding-bottom: 3px;}
Code:<body> <div id="wrap"> <table id="product"> <tfoot> <tr> <td colspan="8">Fine print text goes here. Fine print text goes here. Fine print text goes here.</td> </tr> </tfoot> <thead class="top"> <tr> <th>Heading A</th> <th>Heading 2</th> <th>Heading <br />3</th> <th>Heading <br />4</th> <th>Heading <br />5</th> <th>Heading 6</th> <th>Heading 7</th> <th>Heading 8</th> </tr> </thead> <tbody> <tr> <td>Product Name</td> <td>Info 2</td> <td>Info 3</td> <td>Info 4</td> <td>Info 5</td> <td>Info 6</td> <td>Info 7</td> <td>Info 8</td> </tr> <tr> <td>Product Name</td> <td>Info 2</td> <td>Info 3</td> <td>Info 4</td> <td>Info 5</td> <td>Info 6</td> <td>Info 7</td> <td>Info 8</td> </tr> <tr> <td>Product Name</td> <td>Info 2</td> <td>Info 3</td> <td>Info 4</td> <td>Info 5</td> <td>Info 6</td> <td>Info 7</td> <td>Info 8</td> </tr> <tr class="spacer"></tr> <thead> <tr> <th>Heading B</th> <th>Heading 2</th> <th>Heading <br />3</th> <th>Heading <br />4</th> <th>Heading <br />5</th> <th>Heading 6</th> <th>Heading 7</th> <th>Heading 8</th> </tr> </thead> <tr> <td>Product Name</td> <td>Info 2</td> <td>Info 3</td> <td>Info 4</td> <td>Info 5</td> <td>Info 6</td> <td>Info 7</td> <td>Info 8</td> </tr> <tr> <td>Product Name</td> <td>Info 2</td> <td>Info 3</td> <td>Info 4</td> <td>Info 5</td> <td>Info 6</td> <td>Info 7</td> <td>Info 8</td> </tr> <tr> <td>Product Name</td> <td>Info 2</td> <td>Info 3</td> <td>Info 4</td> <td>Info 5</td> <td>Info 6</td> <td>Info 7</td> <td>Info 8</td> </tr> <tr class="footSpacer"></tr> </tbody> </table> </div> </body>Code:body {font-family: arial, helvetica, sans-serif; font-size: 16px; color:#696969;} #wrap {border: 1px solid blue; padding-left: 10px; float: left;} table#product { border-collapse:collapse;} table#product thead th{border-top: 2px solid #D3D3D3; color: black; padding-bottom: 3px;} table#product thead.top th{border-top: 2px solid transparent;} table#product thead th:before {content:'.'; color:transparent; display: block; font-size: 8px;} table#product tr:last-of-type:after {content: '.'; color:transparent; display: block;font-size: 8px; } table#product thead th:nth-child(1) {width:30%;} table#product thead th:nth-child(2) {width:10%;} table#product thead th:nth-child(3) {width:10%;} table#product thead th:nth-child(4) {width:10%;} table#product thead th:nth-child(5) {width:10%;} table#product thead th:nth-child(6) {width:10%;} table#product thead th:nth-child(7) {width:10%;} table#product thead th:nth-child(8) {width:10%;} table#product th { text-align: left; vertical-align: bottom; font-size: .8em; padding-right: 10px; font-weight: 700; } table#product .spacer {} table#product tr.footSpacer { display: block; height: 25px;} table#product td {padding-bottom: 3px; font-size: .8em;} tfoot {font-style: italic;}




Reply With Quote
