[HTML] / [CSS] multiple width's in one table

Glaanieboy

OSNN Veteran Addict
Joined
6 Mar 2002
Messages
2,628
I am currently making a news page, for my Songviewer webpage. Each news item contains 3 parts, as you can see in this working example, the date/posted by, title and message body. I have created 4 example news items, which all are in one table. I have decided, to make them stand out better, that both the title and message body get a border and a background color (the colors on the working example are there only for the test, don't brag about it). All nice and well, but I want the width of the title bar to be smaller than the message width. With smaller I mean just as wide as the title-text.

I can think of one option: Use multiple tables for one message, ie creating a table for the date/posted by, one table for the title and one for the message. The width for the title-table is calculated by a PHP script (strlen($text) * font-width) which is put in a style="width : <title width>;". But I don't want that, because that would make my page be cluttered with tables.

Does anyone know of a way by doing this with HTML or CSS or should I use PHP instead?
 
I added a class (border, background-color, etc) on the title-text, instead of the td.
Probably not what you want, but it's all I can think of right now.
 

Attachments

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. 🙁

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,016
Messages
673,499
Members
5,627
Latest member
Setups
Back