Why won't this html table format correctly?
-
<pre> <html> <head> <style type="text/css"> table.events { border-collapse: collapse; } table.events th, table.events td { padding: 4px; border: 1px solid #000066; } table.events th { font-size: x-small; text-align: left; background: #241374 url(header-bg.jpg) color: #ffffff; padding-top: 0; padding-bottom: 0; padding-left: 2px; padding-right: 2px; } table.events td { font-size: small; } table.events caption { color: #000066; font-size: small; text-align: left; padding-bottom: 5px; font-weight: bold; } </style> </head> <body> <table class="events" summary="Details of upcoming club events and dive trips"> <caption>Club events/dive trips for the next six months</caption> <tr> <th>Date</th> <th>Event Description</th> <th>Approximate Cost</th> <th>Contact</th> </tr> <tr> <td>12 July</td> <td>Committee meeting, deciding on next year's trips</td> <td>N/A</td> <td>Bob Dobalina</td> </tr> <tr> <td>19 July</td> <td>7-day trip to Hurghada (package deal) - limted spaces</td> <td>£260 pp (all inclusive), departing Luton</td> <td>Bob Dobalina</td> </tr> <tr> <td>5 August</td> <td>Ocean & Sports Diver Theory Course</td> <td>Call for details</td> <td>Jeff Edgely</td> </tr> <tr> <td>12 August</td> <td>Murder Mystery Weekend, Cotsworlds (no diving!)</td> <td>£65 pp (accommodation included)</td> <td>Jill Smith</td> </tr> </table> </body> </pre> <br/> <br/> <br/> Ignore the Pre tags
-
Answer:
No problem with CSS as is except need to add semicolon: background: #241374 url(header-bg.jpg); That would be better if you set a width/height for the background image in the th cells: width: XXpx; height: px; background: #241374 url(header-bg.jpg) no-repeat center scroll; Since the CSS is for ONE table only, you could have just used the table tag for it: table { ... } table th { ... } table caption{ ... } or just called each without the "table" for the th/td: table { ... } th { ... } caption{ ... } Should you have sub-tables, you can just use an id and not a class for the tables except where the same CSS rules apply. Ron
Tim at Yahoo! Answers Visit the source
Other answers
Your CSS is wrong table.events { border-collapse: collapse; } should be #events { border-collapse: collapse; } You don't need the table. before it. You also have to assign the <tr><td> and <th> tags separately so for example you would do CSS: #events { border-collapse: collapse; } #demo { padding: 4px; border: 1px solid #000066; } HTML: <table id="events"> <tr> <th id="demo"></th> </tr> </table>
Andrew
Related Q & A:
- Why won't my app run in the IOS simulator?Best solution by Stack Overflow
- Why won't my text wrap around the image?Best solution by Stack Overflow
- Why won't Tumblr video show on my Tumblr?Best solution by answers.yahoo.com
- Why won't my @media queries work?Best solution by stackoverflow.com
- Why can't my air conditioner work correctly?Best solution by AllExperts
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.