...

View Full Version : Table challenge



klevis miho
06-14-2012, 03:19 PM
How can I do this kind of table? The content to be in the center, but the td's background to stretch 100% of the browsers width?

Redcoder
06-14-2012, 06:29 PM
Use CSS to position the elements.

This is a crude example but just illustrates how to use your CSS well.


<style>
.end_cells{
width: 500px;
}
table{
border-collapse: collapse;
}
#right_align_text{
text-align: right;
}

</style>
HTML


<table border="1" >
<tr>
<td id="right_align_text" class="end_cells">text</td>
<td>text</td>
<td >text</td>
<td>text</td>
<td class="end_cells"></td>
</tr>
<tr>
<td id="right_align_text" class="end_cells">text</td>
<td>text</td>
<td >text</td>
<td>text</td>
<td class="end_cells"></td>
</tr>

</table>

felgall
06-14-2012, 09:33 PM
I think an easier option would be to not worry about the end cells.

You could put the table in a div, center the table within the div and put the bg in the div which by default has 100% width.

I agree. The table would be much easier to read that way than it would with the stipes extending to the edge of the viewport, more so when the viewport is several times the width that the table needs to be.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum