class attribute selection and assignment

J

Jon Slaughter

Is it possible to do something like assign to an attribute
SomeClass.SomeAttribute? If not it should be?

I have two spots where I use the same value and they have to be the same
value at all times. Basically I have to use two divs that have the same
width but one is transparent with a higher z-order and the other supplies
the background color with a lower z order(while something sits inbetween).
In any case, I have to set the width to the same value but I'd rather just
keep it in one spot. Would be nice if I could just use
width:OtherClass.width; instead of later on forgetting that I had two spots
and end up only changing one.

Thanks,
Jon
 
J

Jonathan N. Little

Jon said:
Is it possible to do something like assign to an attribute
SomeClass.SomeAttribute? If not it should be?

No. You can define a class to be different for different ELEMENTS

P.bigboy { font-size: 2.5em; color: blue; background-color: white; }
LI.bigboy {font-size: 1.5em; color: white; background-color: black; }

You can style ELEMENTS with certain ATTRIBUTES

/* Only ACRONYMs that have a title, but IE again will not coop */
ACRONYM[title] { border: 1px dotted silver; }
I have two spots where I use the same value and they have to be the same
value at all times. Basically I have to use two divs that have the same
width but one is transparent with a higher z-order and the other supplies
the background color with a lower z order(while something sits inbetween).
In any case, I have to set the width to the same value but I'd rather just
keep it in one spot. Would be nice if I could just use
width:OtherClass.width; instead of later on forgetting that I had two spots
and end up only changing one.

You can apply more than one CLASS to an ELEMENT...

..FrameUp { border: 5px inset blue; padding: .5em; }
..Landscape { height: 10em; width: 15em; }
..Portrait { height: 15em; width: 10em; }


<div class="FrameUp Landscape">Framed Landscape</div>
<div class="FrameUp Portrait">Framed Portrait</div>

BTW: Most times z-index fiddling is not required, only on positioned
elements and normally can be avoided by the order within the markup.
 
J

Jon Slaughter

Jonathan N. Little said:
No. You can define a class to be different for different ELEMENTS

P.bigboy { font-size: 2.5em; color: blue; background-color: white; }
LI.bigboy {font-size: 1.5em; color: white; background-color: black; }

ok. I didn't know that. Doesn't help me out now but useful to know in the
future. (I suppose I could use it though to accomplish my task but doesn't
seem any better than just doing it directly).
You can style ELEMENTS with certain ATTRIBUTES

/* Only ACRONYMs that have a title, but IE again will not coop */
ACRONYM[title] { border: 1px dotted silver; }
I have two spots where I use the same value and they have to be the same
value at all times. Basically I have to use two divs that have the same
width but one is transparent with a higher z-order and the other supplies
the background color with a lower z order(while something sits
inbetween). In any case, I have to set the width to the same value but
I'd rather just keep it in one spot. Would be nice if I could just use
width:OtherClass.width; instead of later on forgetting that I had two
spots and end up only changing one.

You can apply more than one CLASS to an ELEMENT...

.FrameUp { border: 5px inset blue; padding: .5em; }
.Landscape { height: 10em; width: 15em; }
.Portrait { height: 15em; width: 10em; }

yeah, but when the attribute I need to change is only one element it seems
kinda redudant to create a new class(Since that class is essentially just a
pointer to that element). This is essentially what I did but it seems like
it could be a mess if I have to do it more than a few times.
<div class="FrameUp Landscape">Framed Landscape</div>
<div class="FrameUp Portrait">Framed Portrait</div>

BTW: Most times z-index fiddling is not required, only on positioned
elements and normally can be avoided by the order within the markup.

Yeah, but because the way I have it layed out and the effect I want I have
to to something strange. Maybe it can be done with normal z-indexing and I
have messed up code but thats not so much my problem at this point. (I'll
probably rewrite all the code once I get a grasp of how everything is going
to work)



Thanks,
Jon
 
J

John Hosking

Jon said:

Can't have enough Jo(h)ns in a thread...
Yeah, but because the way I have it layed out and the effect I want I have
to to something strange.

Pity you have no control over ... yourself. :)
Maybe it can be done with normal z-indexing

Are you paying attention? Or are you re-inventing the language again?
Jonathan suggests *not* fiddling with the z-index. I recommend the same.
and I
have messed up code but thats not so much my problem at this point.

Whose problem is it then? (I know; it's ours. We have to keep seeing
your posts...) I say, boldly, that the z-index, which is something of an
advanced tool and which you have clearly not mastered, is causing you
more problems than you need. I will further say, just as boldly, that
the sooner you (or anyone; this is true for all of us) get rid of the
messed-up code the better everything will be. Start over.
(I'll probably rewrite all the code once I get a grasp
of how everything is going to work)

No, rewrite it now. It's a simple two-column layout. Don't fight it.
 
J

Jonathan N. Little

John said:
Can't have enough Jo(h)ns in a thread...


Ah, but I am not a Jo[h]n...

http://en.wikipedia.org/wiki/John_(name)#Jon_.2F_Jonathan
John (name) - Wikipedia, the free encyclopedia
Pity you have no control over ... yourself. :)


Are you paying attention? Or are you re-inventing the language again?
Jonathan suggests *not* fiddling with the z-index. I recommend the same.

Yes, but I am afraid Jon's a better fiddler than a listener. What he
should do is look up Son Of SuckerFish and be done with it...

http://www.htmldog.com/articles/suckerfish/
Sons of Suckerfish | HTML Dog

In fact if he's stop finger-painting with HTML and CSS and learn a
little bit first by doing the tutorials at the site www.htmldog.com he
would understand why his menu doesn't have a border. And maybe he'd be
easier to advise when he really gets stuck...but what do I know.
 
A

Andy Dingley

ok. I didn't know that.

Then get yourself a half decent CSS tutorial (buy a copy of Lie & Bos,
you'll probably like it) and learn the basics of CSS before you start
re-designing the language.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top