Although stackoverflow isn't the place where dreams of lazy people should come true. Well, let's say I'm doing this as an exception:
- First of all, your HTML table structure seems semantically wrong.
<th>
stands for HTML Table Header Cell Element, but your contents seem to be semantically table cells that contain data, also known as <td>
.
- Second, you're mixing CSS and obsolete presentation tags and attributes like
cellpadding
or font
. You should avoid that.
Here's my cleaned up approach on your structure:
HTML:
<table id="dataTable" cellspacing="0">
<thead>
<tr>
<th>Music Title</th>
<th>Bitrate/File Size</th>
<th>Download Link</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $MusicTitle;?></td>
<td><?php echo $p['bit'];?></td>
<td><a href="<?php echo $p['url'];?>">Download</a></td>
</tr>
</tbody>
CSS:
#dataTable { /* cellspacing is still necessary on `<table>` */
width: 70%;
border: 1px solid #000;
border-collapse: collapse;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
table-layout: fixed;
white-space: pre;
white-space: -moz-pre-wrap; /* Firefox 1.0-2.0 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: pre-wrap; /* CSS 3 */
white-space: pre\9; /* IE7+ */
word-wrap: break-word; /* IE 5.5-7 */
word-break: break-all; /* Webkit */
white-space: normal;
}
#dataTable th {
padding: 5px;
}
#dataTable th:nth-child(1) {
color: #0F0;
}
#dataTable th:nth-child(2) {
color: #F00;
}
#dataTable td {
border: 1px solid #000;
padding: 5px;
font-weight: bold;
text-align: center;
}
#dataTable td:first-child {
text-align: left;
}
See also http://jsfiddle.net/Volker_E/QL4cX/1/