navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Different Font Styles on the Same Page

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> Different Font Styles on the Same Page
Page: [1]
 
Bruce2000

 

Posts: 147
From: Huntsville AL USA
Status: offline

 
Different Font Styles on the Same Page - 1/14/2007 14:42:46   
Lets say I have some text in one cell that is going to be over a dark background so I'd like to make the font color white....but in another cell, I have a white background so I'd like to make the font a darker color. These colors will be the same on all pages so I'd like to use css. Is it better to create a seperate stylesheet for the white cell and the dark cell? Or can I specify in one stylesheet which cell to make white font?
I made a stylesheet for my page but it changes the font for the entire page. CSS seems a bit confusing.

Bruce
jaybee

 

Posts: 13972
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: Different Font Styles on the Same Page - 1/14/2007 14:48:30   
there are several ways to do it but to get you started we can go with the simple one.

In the css file

.white {color:#fff;}
.black {color:#000;}
.red {color:#f00;}

In the code

If you want the entire section (div, table cell) whatever you're using:

<div class="white"> will apply to the whole div unless you apply a different color to a child of the div.

<td class="black"> Will make the contents of the cell black

If you just want a few words a different colour then

<p>I want to have <span class="red">these words red</span> but not these words.</p>
will result in

I want to have these words red but not these words.

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to Bruce2000)
Bruce2000

 

Posts: 147
From: Huntsville AL USA
Status: offline

 
RE: Different Font Styles on the Same Page - 1/15/2007 3:51:09   
Ok, here is what I am talking about. On my website pages:
My site

You see in my header bar, the navigation links. But that background is different than the body (white) so I can use a white font here but not in the body.

What I did was make a class identification for those links which are to be white and I placed before each of the links in the header bar like this:
<a class="header" href="..... >

Then in my style sheet I made this entry:
a.header:link {font-size: 12; font-weight: bold; color: #FFFAFA;}

Is that the correct way of doing it? Would I just create a new entry for visited and active like this: a.header:visited?

Also: you see the black vertical seperators between the links. In my site's online version I made each link fit neatly between the seperators by use of spaces. This can be done in css, right? I can remove all the extra spaces but I can't figure out how to increase the space between each word so they will fit into their spaces. Those seperators are not a font - they were built into the grey bar background. I should also mention that the links were placed in those spots simply with a <p> tag and margin & indent for the first word, "work", from its home position, in the top left corner of the cell. (the picture portion of my header is a cell) and the words that come after "work" are simply aligned with spaces. The only way I can think of doing it is by making some CSS commands for margin and indent, but then I would have to give each link word its own ID and each one wouldbe at a different indent value. This would mean that for each ID, I'd also have to copy all the CSS font tags. Unless I maybe create a <div> around all those links and apply the font declarations to all those links at once. I'm not sure if this is the right way to do this.

< Message edited by Bruce2000 -- 1/15/2007 4:30:38 >

(in reply to jaybee)
womble

 

Posts: 5461
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: Different Font Styles on the Same Page - 1/15/2007 4:37:11   
You'll need to add either padding or margins to increase the space, e.g. a.header { padding-right: 10px; } (not sure how much you'll need - you'll need to play around with it until it looks right)

_____________________________

~~ "A cruel god ain't no god at all" ~~
:)

(in reply to Bruce2000)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> Different Font Styles on the Same Page
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts