...

View Full Version : how far do classes work in css?



duniyadnd
12-17-2002, 08:50 PM
Just curious, I was going through some rudimentary css coding, and I wrote two sets of bold characterstics. One labled as b, the other labled as b.2

The first one would be automatically whenever the tag <b> was included.

Now on IBM compatible PCs, I've seen that calling in the second type of b works fine by saying: <b class="2">

However, I switch over to the Macs, and it stops at the default "b" style.

Is there a way of going around this?

Here are the two sets of styles:

b
{ font-family: Verdana, Arial, Helvetica, sans-serif; font-style: normal; line-height: 10pt; font-weight: bold; font-variant: normal; color: #0e3d9e; text-decoration: none; text-align: justify}

b.2
{ font-family: Verdana, Arial, Helvetica, sans-serif; font-style: normal; line-height: 10pt; font-weight: bold; font-variant: normal; color: #ffffff; text-decoration: none; text-align: justify}

The only difference is the text color.

Thanks
Duniyadnd

krycek
12-17-2002, 09:49 PM
I think you will find it isn;t the PC that's the problem but the browser.

style.style works in some browsers (not sure which) but you will get a universal result by putting a space in; e.g. style .style

that also allows you to nest them more deeply, e.g. style .style .style

I think I am correct on this :)

::] krycek [::

duniyadnd
12-17-2002, 10:12 PM
cool, i'll try that out. I should have mentioned that both type of machines I was using IE, 5.0/5.5/6.0 on the PC, not sure which one on the Mac.

Thanks
Duniyadnd

duniyadnd
12-18-2002, 02:12 AM
Okay i tried out your suggestion, but it didn't work.. :confused:

I tried three ways:

b. 2

and

b .2

and

b . 2

none of them worked, and this on IE 6.0 PC.

duniyadnd

krycek
12-18-2002, 02:40 AM
I am not sure if it because you are using a number only, because I am pretty sure that valid names should start with a letter.

Also, I am not convinced that styling the <b> tag is a good idea... try styling divs or spans instead :) (there is nothing wrong in theory as far as I know but it just seems odd to me lol)

but the method itself is sound

::] krycek [::

duniyadnd
12-18-2002, 03:06 AM
So true, it might be because of the number. I'll try that, but can only confirm with macs later on tonight.

btw, the space thing still doesn't work. The problem with divs is that I heard I can only use it for a unique location per page, and I want to avoid that, as I might want to use the different options wherever I need to. Never used span either.

Duniyadnd

ronaldb66
12-18-2002, 10:10 AM
Eh? Could you eleborate on that? I tried a test layout recently and used both divs and spans all over the place, liberally using several different classes without a hitch. I you mean that a div element by default behaves as a block element so you can't have more then one horizontally, consider positioning or, simpler, set display: inline, or use span elements which behave by default as inline elements. Then again, maybe i'm barking up the wrong tree here.

duniyadnd
12-24-2002, 11:50 PM
eh, would you believe it, there was no problem at all with the difference between the macintosh and pc versions except for the fact that the macintosh is less forgiving. In the css file, I by mistake wrote:

line-height: 11ph

Needless to say, it gave me a HUGE gap and which prompted me to ask this question as I somehow kept missing that.

As for your question ronaldb66, I was going through the w3schools.com website figuring out the restrictions and such that, and since I was going through exam week and lack of sleep etc. I read everything in a lopsided way. Sorry for the confusion.

But you can reference the tutorial from their site.

W3Schools (http://www.w3schools.com)

Thanks for the input people
Duniyadnd

ronaldb66
12-27-2002, 08:15 AM
Know it, love it, use it all the time! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum