Dysan Posted December 27, 2007 Share Posted December 27, 2007 Hi, I have the following code, can creates a simple 1 column by 2 row table. How do I display "Persons First Name" in bold, without displaying "Persons Last Name" in bold? e.g. Persons First Name Persons Last Name <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> <table width="246" border="1" class="coll"> <tr> <th width="135">Name</th> <th width="95"> </th> </tr> <tr> <td id="bold">Persons First Name<br> Persons Last Name </td> <td> </td> </tr> </table> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/83311-bold-table-text-css/ Share on other sites More sharing options...
wolfrat Posted December 27, 2007 Share Posted December 27, 2007 replace <tr> <td id="bold">Persons First Name<br> Persons Last Name </td> <td> </td> </tr> </table> with <tr> <td><strong>Persons First Name</strong><br> Persons Last Name </td> <td> </td> </tr> </table> Yeah I know it's not css, but sometimes simpler is better Quote Link to comment https://forums.phpfreaks.com/topic/83311-bold-table-text-css/#findComment-424143 Share on other sites More sharing options...
mainewoods Posted December 28, 2007 Share Posted December 28, 2007 --put in the head of your document <style type="text/css"> .bold { font-weight:bold; } </style> --surround whatever you want bold with the span /span tags with the class="bold". reuse as many times as you like in your document <tr> <td id="bold"><span class="bold">Persons First Name</span><br> Persons Last Name </td> <td> </td> </tr> Quote Link to comment https://forums.phpfreaks.com/topic/83311-bold-table-text-css/#findComment-424464 Share on other sites More sharing options...
dbrimlow Posted December 28, 2007 Share Posted December 28, 2007 First, is there any reason you use "td id=bold"? If you didn't set a css id called #bold in your style sheet than it is unnecessary ... remove it. Second, since you are using a transitional doctype, you can indeed use either "stong" or even the old "b" for bold tag because transitional allows you to use text in table cells without block level tags - as follows: <tr> <td><strong>Persons First Name</strong><br> Persons Last Name </td> <td> </td> </tr> </table> or, <tr> <td><b>Persons First Name</b><br> Persons Last Name </td> <td> </td> </tr> </table> Either one is perfectly fine. Quote Link to comment https://forums.phpfreaks.com/topic/83311-bold-table-text-css/#findComment-424885 Share on other sites More sharing options...
dropfaith Posted December 28, 2007 Share Posted December 28, 2007 for bold text wouldnt class be a better use for something so common td class="bold" id shouldnt be used on common css properties. then css would just be .bold {font-weight:bold;} Quote Link to comment https://forums.phpfreaks.com/topic/83311-bold-table-text-css/#findComment-424898 Share on other sites More sharing options...
dbrimlow Posted December 30, 2007 Share Posted December 30, 2007 Yes, for ALL bold text. We're talking about just the first name being bold. So forget the styling in the td tag. So for one word you can use the old "bold" tag (html) <b>First name</b> Last name or the newer "strong" tag (html, xml and xhtml) <strong>First name</strong> Last name or a css class based "span" tag: <span class="bold">First name</span> Last name Quote Link to comment https://forums.phpfreaks.com/topic/83311-bold-table-text-css/#findComment-425719 Share on other sites More sharing options...
mainewoods Posted December 30, 2007 Share Posted December 30, 2007 I say start out by doing it the 'standards' way, instead of learning the 'old' way and having to unlearn bad habits like many of us are already doing. --forget about the strong and b tags which have already been deprecated for a long time and do it this way: <span class="bold">First name</span> Last name Quote Link to comment https://forums.phpfreaks.com/topic/83311-bold-table-text-css/#findComment-425977 Share on other sites More sharing options...
dbrimlow Posted December 30, 2007 Share Posted December 30, 2007 Mainewoods, is right, of course. Dysan SHOULD actually learn how to use css correctly and avoid ALL deprecated markup elements. This: <table width="246" border="1" class="coll"> Should be either this: <table style="width;246px; border:1px solid #000000"> or this: <table class="coll">, with this in the css: .coll { width;246px; border:1px solid #000000" } Quote Link to comment https://forums.phpfreaks.com/topic/83311-bold-table-text-css/#findComment-426066 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.