Setting text attributes of specific text via CSS?

  • Thread starter Thread starter Bruce Stemplewski
  • Start date Start date
B

Bruce Stemplewski

I have the following style in my CSS file.

Body {text-decoration: none; color: #000000; font: 16px Arial, Helvetica}

I can apply that to a paragraph. If I try applying a style to specific
text within that paragraph such as

h1 {text-decoration: none; color: #00CCCC; font: 20px Arial, Helvetica;
font-weight:bold}

then it changes the style of the whole paragraph. How can I change the
style of specific text via my CSS file?
 
Hi Bruce,

The selectors that you're using (Body and h1) cause those elements to have
the properties specified.

If you want just some specific text to have specific properties use a span
tag with class attribute. An use the class name as the selector

This is my very short paragraph to demonstrate CSS. The following words
<span class="myText">"CSS is Cool"</span> will be changed via CSS with a
selector of myText.

myText { color: Navy; font: 16px Arial, Helvetica; }
 
Thanks Mike but that does not seem to be working for me.

My HTML looks like this:

<p>I am working on a new look at <span class="cdTitle">Caribe
Dreamin'</span>.&nbsp;&nbsp;
I would like to make the site a bit more user friendly and search engine
friendly.&nbsp; One thing that is being done is the removal of
frames.&nbsp;</p>

cdTitle {text-decoration: none; color: #00CCCC; font: 16px Arial, Helvetica}
 
What doesn't work - provide a URL
FYI the CSS text-decoration: none is only valid for hyperlinks

--




| Thanks Mike but that does not seem to be working for me.
|
| My HTML looks like this:
|
| <p>I am working on a new look at <span class="cdTitle">Caribe
| Dreamin'</span>.&nbsp;&nbsp;
| I would like to make the site a bit more user friendly and search engine
| friendly.&nbsp; One thing that is being done is the removal of
| frames.&nbsp;</p>
|
| cdTitle {text-decoration: none; color: #00CCCC; font: 16px Arial, Helvetica}
|
|
| | > Hi Bruce,
| >
| > The selectors that you're using (Body and h1) cause those elements to
| have
| > the properties specified.
| >
| > If you want just some specific text to have specific properties use a span
| > tag with class attribute. An use the class name as the selector
| >
| > This is my very short paragraph to demonstrate CSS. The following words
| > <span class="myText">"CSS is Cool"</span> will be changed via CSS with a
| > selector of myText.
| >
| > myText { color: Navy; font: 16px Arial, Helvetica; }
| >
| > --
| > Mike -- FrontPage MVP '97-'02
| > http://www.websunlimited.com
| > FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
| > --------------------------------------------------------------------------
| --
| > --------------------
| > If you think I'm doing a good job, let MS know at (e-mail address removed)
| >
| message
| > | > > I have the following style in my CSS file.
| > >
| > > Body {text-decoration: none; color: #000000; font: 16px Arial,
| Helvetica}
| > >
| > > I can apply that to a paragraph. If I try applying a style to specific
| > > text within that paragraph such as
| > >
| > > h1 {text-decoration: none; color: #00CCCC; font: 20px Arial, Helvetica;
| > > font-weight:bold}
| > >
| > > then it changes the style of the whole paragraph. How can I change the
| > > style of specific text via my CSS file?
| > >
| > >
| > >
| > >
| >
| >
|
|
 
Hi Bruce,

your class name needs to be preceeded with a dot(.), eg
<style type="text/css">
..cdTitle {
color: #0CC;
font: 16px Arial, Helvetica}
</style>

<span class="cdTitle">stuff</span>

Jon
Microsoft MVP - FP
 
Thanks Jon! That did it.

Bruce

Jon Spivey said:
Hi Bruce,

your class name needs to be preceeded with a dot(.), eg
<style type="text/css">
.cdTitle {
color: #0CC;
font: 16px Arial, Helvetica}
</style>

<span class="cdTitle">stuff</span>

Jon
Microsoft MVP - FP

"Bruce Stemplewski" <[email protected]> wrote in
 
Back
Top