?
Solved

How do I change a class in a <td>

Posted on 2014-07-27
4
Medium Priority
?
111 Views
Last Modified: 2014-08-13
I have a table that looks like this:

Address
Building Name
Crossing Streets

<td = class="Body_Labels"

I want to change the font for "Building Name" and "Crossing Street".
0
Comment
Question by:breeze351
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40222998
...
<td class="Body_Labels">
Address
<span class="sub_labels">
 Building Name
 Crossing Streets
</span>
</td>
...
<style>
.sub_labels {
font:arial
}
</style>

Open in new window

0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 40223038
you can use span or div tags inside your code,  and give them a class
0
 
LVL 3

Expert Comment

by:Conner Turner
ID: 40223084
Hi breeze351,

This is very simple you just need to define some CSS for your class.

You can either wrap the whole section in a <div class="font"> and assign the font to the div by doing the following into your HTML code:

<style>
div.font {
    font-family: 'Tahoma';
}
</style>

Open in new window


Within this example I have used Tahoma as an example font, you would want to replace this with the name of your font that you wish for the table to be displayed in.

The other way you can do this is by assigning both <td> which contain the "Building Name" and "Crossing Streets" a class which they both share

<td class="Body_Labels">
Address
<span class="font_custom">Building Name</span>
<span class="font_custom">Crossing Streets</span>
</td>
...
<style>
span.font_custom {
    font-family: 'Tahoma';
}
</style>

Open in new window


Again this method allows you to take out and implement each sub level with a different font if needed at a later stage, as with the previous example I have used Tahoma as a font, you will need to change this to the font that is required.

HTH,
C
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question