473,322 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to define an absolute overall text style class ?

I want to define a text style class which is active whenever I refer to it.
The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }

in HTML:
.....
<TABLE><TR><TD>
<class=bluetext>this should appear in blue</class>
</TD>
<TDThis should appear in some other style</TD>
....

Even when I encapsulate it in a <Ptag it doesn't work

.....
<TABLE><TR><TD>
<P class=bluetext>this should appear in blue</P>
</TD>
<TDThis should appear in some other style</TD>
....

Why ?

Is there another wway ?

Keith
May 9 '07 #1
14 3314
On 2007-05-09, Keith Clark <k.*****@lucent.comwrote:
I want to define a text style class which is active whenever I refer to it.
The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }
You need a . before bluetext. Currently that selects the bluetext
_element_ (which doesn't exist in HTML), not the bluetext class.
in HTML:
....
<TABLE><TR><TD>
<class=bluetext>this should appear in blue</class>
No there you're using a class element, which doesn't exist in HTML
either, and wouldn't match your selector either.
></TD>
<TDThis should appear in some other style</TD>
...

Even when I encapsulate it in a <Ptag it doesn't work

....
<TABLE><TR><TD>
<P class=bluetext>this should appear in blue</P>
That's more like it.
></TD>
<TDThis should appear in some other style</TD>
...

Why ?
You're just not getting the basic syntax right!
May 9 '07 #2
On 09 May 2007 08:59:29 GMT, k.*****@lucent.com (Keith Clark) wrote:
I want to define a text style class which is active whenever I refer to it.
The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }
Perhaps
.bluetext { COLOR: blue; FONT-SIZE:16px; }
will work for you.

--
Steven
May 9 '07 #3
rf
"Keith Clark" <k.*****@lucent.comwrote in message
news:46**********************@newsspool2.arcor-online.net...
>I want to define a text style class which is active whenever I refer to it.
The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }
..bluetext ...
<class=bluetext>this should appear in blue</class>
Bad idea however. What if you want to change the colour. Then you would
have:

..bluetext{color: red; ...

Better to call it .importantcell

--
Richard.
May 9 '07 #4
Scripsit Keith Clark:
I want to define a text style class which is active whenever I refer
to it. The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }
In addition to using wrong syntax, it is all wrong in all points, including
a clueless class name, clueless color (using default link color for
something that isn't a link), cluelessly setting color without setting
background, and clueless unit for font size.

So stop right now. Don't dig any deeper. Get a decent book on web authoring
and read it.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

May 9 '07 #5
On 9 May, 09:59, k.cl...@lucent.com (Keith Clark) wrote:
I want to define a text style class
Actually you need to define a "CSS selector", which will probably make
use of a HTML class.
which is active whenever I refer to it.
You can't do (exactly) that in CSS. It can take its place in the
queue, but all the rules are always evaluated and anything might
possibly get applied, according to the cascade and specificity rules.
You can make a strong selector, but it still might get outweighed
later. Nothing is provable unless you know both the CSS and the HTML -
you can't write an "absolute and forever" rule in CSS alone.

For your purposes though, this class is probably going to do what you
need.
in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }
Try using .bluetext instead. Bare names are element names, those with
a leading period apply to classes, those with a leading hash to id
values.


May 9 '07 #6
Keith Clark wrote:
I want to define a text style class which is active whenever I refer to it.
The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }
Firstly to specify a CLASS in your stylesheet you must prefix the class
name with a "."

..bluetext { COLOR: blue; FONT-SIZE:16px; }
>
in HTML:
....
<TABLE><TR><TD>
<class=bluetext>this should appear in blue</class>
</TD>
<TDThis should appear in some other style</TD>
...

Because there is no CLASS *element* in HTML, but a CLASS *attribute*
<table>
<tr>
<td class="bluetext">this will appear in blue</td>
<td>This will appear in whatever is your default style</tr>


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
May 9 '07 #7
Gazing into my crystal ball I observed k.*****@lucent.com (Keith Clark)
writing in news:46**********************@newsspool2.arcor-online.net:
in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }
That should be .bluetext - please note the leading period
Please don't use pixels for font sizing, it can't be adjusted by some
browsers.
>
in HTML:
....
<TABLE><TR><TD>
<class=bluetext>this should appear in blue</class>
</TD>
<TDThis should appear in some other style</TD>
...
That doesn't look like tabular data, but, anyway,
<p class="bluetext">This is blue text</por <p>This is regular text and
this <span class="bluetext">text is blue</span>.</p>

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

May 9 '07 #8
Keith Clark wrote:
I want to define a text style class which is active whenever I refer to it.
The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }
Learn CSS.
To define a class selector use the correct syntax:
..bluetext { ... }
in HTML:
<class=bluetext>this should appear in blue</class>
There is no such tag as <class>. Learn HTML.
>
<P class=bluetext>this should appear in blue</P>
<TDThis should appear in some other style</TD>
This would work had you defined the rule correctly.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
May 9 '07 #9
Also sprach Keith Clark:
bluetext { COLOR: blue; FONT-SIZE:16px; }
This would refer to a <bluetextelement which, of course, does not exist.
To refer to elements of the *class* named "bluetext" you must write

..bluetext { ... }

Note the preceding dot!

By the way, it is better to choose a class name that conveys some meaning
rather than describing the appearance. For example,

..warning { color: red; font-weight: bold; }

clearly says what it means - a warning -, while

..redBoldText { color: red; font-weight: bold; }

does not give any hint as to *why* this text should be red and bold.
Suppose, you use your .bluetext class and someday you decide that the blue
text should be changed to a shade of green. Then you have two problems: 1)
You may have assigned the .bluetext class to other blue things as well which
should remain blue and not be changed. 2) It would look stupid if a class
called "bluetext" produced green text. So you should first ask yourself:
What is special about that particular piece of text? Why do you want it in a
different color? What does it represent? Is it a warning? Then call the
class "warning". Is it a definition? Then call the class "definition" etc.

Greetings,

Thomas
May 9 '07 #10
Keith Clark wrote:
I want to define a text style class which is active whenever I refer to it.
The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }

in HTML:
....
<TABLE><TR><TD>
<class=bluetext>this should appear in blue</class>
</TD>
<TDThis should appear in some other style</TD>
...

Even when I encapsulate it in a <Ptag it doesn't work

....
<TABLE><TR><TD>
<P class=bluetext>this should appear in blue</P>
</TD>
<TDThis should appear in some other style</TD>
...

Why ?

Is there another wway ?

Keith


In your first HTML example, you have CLASS as an element. It's an
attribute on another element. That is, you should have
<td class=bluetextwithout any </class>.

Some browsers might not recognize "blue" as a value for "color". Try
changing the CSS to
bluetext { COLOR: #0000FF; FONT-SIZE:16px; }

The absolute size for FONT-SIZE is a very bad idea. Specify a size
relative to the user's preferred size.

For the P element in your second HTML example, is it possible you have a
conflicting color CSS?

--

David E. Ross
<http://www.rossde.com/>.

Don't ask "Why is there road rage?" Instead, ask
"Why NOT Road Rage?" or "Why Is There No Such
Thing as Fast Enough?"
<http://www.rossde.com/roadrage.html>
May 10 '07 #11
On 05/09/2007 03:59 AM, Keith Clark wrote:
I want to define a text style class which is active whenever I refer to it.
The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }

in HTML:
.....
<TABLE><TR><TD>
<class=bluetext>this should appear in blue</class>
</TD>
<TDThis should appear in some other style</TD>
....

Even when I encapsulate it in a <Ptag it doesn't work

.....
<TABLE><TR><TD>
<P class=bluetext>this should appear in blue</P>
</TD>
<TDThis should appear in some other style</TD>
....

Why ?

Is there another wway ?

Keith

Encapsulate the text within a P element, but don't forget that classes
in CSS must start with a period:

In CSS:
..bluetext { COLOR: blue; FONT-SIZE:16px; }

May 10 '07 #12
Scripsit David E. Ross:
Some browsers might not recognize "blue" as a value for "color".
It would be a seriously broken browser, so it could just as well fail to
recognize any alternative denotation. We don't need to care about such
issues. There are good reasons to consider using #00f or #0000ff instead of
blue, but lack of support to this color name (which has been there ever
since the web turned into colors) is not one of them.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

May 10 '07 #13
Keith Clark wrote:
I want to define a text style class which is active whenever I refer to it.
The following does not work

in CSS:
bluetext { COLOR: blue; FONT-SIZE:16px; }

in HTML:
....
<TABLE><TR><TD>
<class=bluetext>this should appear in blue</class>
</TD>
<TDThis should appear in some other style</TD>
...

Even when I encapsulate it in a <Ptag it doesn't work

....
<TABLE><TR><TD>
<P class=bluetext>this should appear in blue</P>
</TD>
<TDThis should appear in some other style</TD>
...

Why ?
Your CSS is wrong. To refer to a class, use the syntax
ELEMENT.class {...}
or
.class {...}

--
David
Stardate 7363.7
May 13 '07 #14
Keith Clark wrote:
I want to define a text style class which is active whenever I refer
to it. The following does not work

in CSS: bluetext { COLOR: blue; FONT-SIZE:16px; }
This is amusing. So far ten people have responded over four days to let
you know that you need a dot in front of the word 'bluetext', and you
haven't responded to any of them.

Maybe it is more amusing that ten people responded with the same answer.
:-)

--
-bts
-Motorcycles defy gravity; cars just suck
May 13 '07 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Zeke Koos | last post by:
<body> <div style="position:absolute; left:0px; top:0px; width:780px; height:42px; "> <img src="images/CW---Webpage_01.png" width=780 height=42> </div> <div style="position:absolute; left:0px;...
1
by: Mr.Clean | last post by:
I'm having trouble with this. The checkbox is no where near where it is supposed to be and the radio button is not at 206 px away from the left of the window. Looks bad in IE6, even worse in...
10
by: jlub | last post by:
What I'm trying to do is have two different sets of input elements which occupy the same space on the page, only one of which is visible at a time. You switch between the two with a bit of...
2
by: Laphan | last post by:
Hi All I have developed a site whereby it uses the contents of a folder (incs gifs, jpgs and css files) to display the web 'skin' of the site. This is OK, but each button on the site is an...
3
by: horusprim | last post by:
Is there a CSS absolute positioning rendering bug in FF1.02 and IE 6? I have been experimenting with precision absolute positioning in CSS. The following test content was used in the...
2
by: nino9stars | last post by:
Hello, I have just started messing with absolute positioning on webpages, and it definitely let's you do some creative things. Well, after much searching and help, I got the images I was using...
0
by: Keith Clark | last post by:
I want to define a text style class which is active whenever I refer to it. The following does not work in CSS: bluetext { COLOR: blue; FONT-SIZE:16px; } in HTML: ..... <TABLE><TR><TD>...
6
by: Markus | last post by:
Hello I have a navigation structured as follows: <ul> <li> <a>Chapter1</a> <ul> <li><a>Chapter 1.1</a></li> <li><a>Chapter 1.2</a></li>
5
iam_clint
by: iam_clint | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.