4 replies [Last post]
Vivaldi
Offline
newbie
Last seen: 19 years 50 weeks ago
Timezone: GMT-6
Joined: 2003-04-09
Posts: 3
Points: 0

I have a stylesheet.

In the stylesheet I set the table,th,td tags with specific attributes. One of the attributes is that I want th tags to all have

text-align: left;

I made a special class for when I want a th to be right aligned.
text-align : right;

In my code, I set <th class="RIGHTALIGNTH">

but the th continues to stay left aligned.
if i do an explicit align="right" in the tag, it works, but not if I use a class.

Any ideas?

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 day 16 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5344
Points: 2965

Th class override

Hi Vivaldi,
Sounds like it should work.
Could you post a link to a test page, so we can have a look.

Vivaldi
Offline
newbie
Last seen: 19 years 50 weeks ago
Timezone: GMT-6
Joined: 2003-04-09
Posts: 3
Points: 0

Hmm

I wish I had a place available to post it on the web [ intranet app ].

I will post some code so its an easy test.

the css file:
Table{
border : none;
width : 650px;
}
td{
font : Times New Roman;
font-size : 13px;
text-decoration : none;
}
th{
font : Times New Roman;
color : Black;
font-size : 14px;
font-weight : bold;
text-decoration : none;
}
FTH{
font : Times New Roman;
color : Black;
font-size : 14px;
font-weight : bold;
text-decoration : none;
text-align: right;
}

Thats the css file.

The html (asp file).

<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="civil.css">
</head>
<body >

<table align="center">
<tr>
<th >Court Case #:</th>
<td>EM99999999</td>
</tr>
<tr>
<th class="FTH">Process #:</th>
<td>10222</td>
</tr>
</table>
</body >
</html>

Notice how Process # and Court Case have the same alignment, and shouldn't. Is there no way to override the stylesheet's hold on the alignment?

Thanks for the time.

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 7 years 7 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

Th class override

The top three CSS declarations are referenced to an actual HTML tag (table, td, th). But the fourth is a class so needs to be declared like this (with a .):

.FTH {
  text-align: right;
}

Note that the styles cascade, so as the FTH class is used in a TH cell, all the repeated guff doesn't need to be there, it will take both bits of the CSS.

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

Vivaldi
Offline
newbie
Last seen: 19 years 50 weeks ago
Timezone: GMT-6
Joined: 2003-04-09
Posts: 3
Points: 0

danke

Thanks,

I knew that I needed the . , I guess its been that kind of week.

Thanks for the advice, it was getting frustrating.