Enjoy an ad free experience by logging in. Not a member yet?
Register .
02-04-2004, 07:33 PM
PM User |
#1
Senior Coder
Join Date: Jan 2004
Posts: 2,340
Thanks: 1
Thanked 7 Times in 7 Posts
CSS [when it is an external file]
I have in my HTML document this code
but I want to add a class called "one", so there are two classes, how can I do this?
02-04-2004, 07:39 PM
PM User |
#2
New to the CF scene
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
If I'm reading you right, your external stylesheet should include something like this:
.bold {font-size: 14px; font-weight: bold; color: blue;}
.one {font-size: 12px; color: green;}
Of course, change the attributes as-needed.
This is a very basic CSS technique, which leads me to think that you may find a basic CSS tutorial very useful and, in the end, time saving. There are many such tutorials on the web.
Best wishes,
Mike Wilkinson
Last edited by mwaw; 02-04-2004 at 08:24 PM ..
02-04-2004, 07:41 PM
PM User |
#3
Senior Coder
Join Date: Jan 2004
Posts: 2,340
Thanks: 1
Thanked 7 Times in 7 Posts
Quote:
Originally posted by mwaw
If I'm reading you right, your external stylesheet should include something like this:
.bold {font-size: 14px; font-weight: bold; color: blue;}
.one {font-size: 12px; color: green;}
Of course, chang the attributes as-needed.
This is a very basic CSS technique, which leads me to think that you may find a basic CSS tutorial very useful and, in the end, time saving. There are many such tutorials on the web.
Best wishes,
Mike Wilkinson
i have the lines in the stylesheet, but this does not answer how.
02-04-2004, 07:56 PM
PM User |
#4
New Coder
Join Date: Nov 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Do you want 2 classes for the same element?
If so, then you'll have to do something like this:
Code:
<div class="one"><p class="bold">Stuff</p></div>
And the css would be something like this:
Code:
div.one p.bold {
color: black;
background-color: white;
}
You can't have 2 classes in one element. You have to use ancestries...I guess.
__________________
A wise man can see more from the bottom of a well than a fool can see from the top of a mountain.
02-04-2004, 08:13 PM
PM User |
#5
Senior Coder
Join Date: Jun 2002
Location: Nashua, NH
Posts: 1,724
Thanks: 0
Thanked 0 Times in 0 Posts
Boberto, RTFM before posting
You can apply as many classes to an element as you want:
<p class="bold red underlined">Some text</p>
where CSS declarations are:
.bold
{ font-weight: bold;
}
.red
{ color: red;
}
.underlined
{ text-decoration: underline;
}
__________________
Vladdy |
K L
"Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"
02-04-2004, 08:18 PM
PM User |
#6
The thread killer
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
Wrong. You can have multiple classes in an element, just separate them with a space. <p class='white on black'> is an element with three classes, 'white', 'on', and 'black'.
02-04-2004, 08:19 PM
PM User |
#7
Senior Coder
Join Date: Jan 2004
Posts: 2,340
Thanks: 1
Thanked 7 Times in 7 Posts
Having worked out I can do it so all of <p> if affected I only need the one class in the end.
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 11:06 PM .
Advertisement
Log in to turn off these ads.