Jump to content

Bold Table Text (CSS)


Dysan

Recommended Posts

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>

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

--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>

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"

}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.