PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.info.authoring.CSS > Form element inheritance
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Form element inheritance

Réponse
 
LinkBack Outils de la discussion
Vieux 10/03/2008, 15h28   #1
jjamjim@yahoo.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Form element inheritance

I have a problem with styles not being inherited into form elements
such as textarea and input.

<span class="myclass"><textarea>txt</textarea></span>

So if "myclass" specifies "color:blue" I would expect the text in the
textarea to be blue. But it isn't - at least not in the browsers I
have tried (firefox, opera, ie).

I can't find any information about this. I've had a good look
through the css specification, but couldn't find anything about
elements not inheriting styles.

I have tried duplicating the class on the form element:

<span class="myclass"><textarea class="myclass">txt</textarea></span>

That's better, but relative size properties cause problems. If
"myclass" has font-size:200%. The textarea font would actually turn
out 4 times the size.

So are the browsers incorrectly implementing the spec? Or am I
missing something. If this is a known problem, is there a
workaround?

  Réponse avec citation
Vieux 10/03/2008, 16h03   #2
Steve Pugh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Form element inheritance

On Mar 10, 2:28pm, jjam...@yahoo.com wrote:
> I have a problem with styles not being inherited into form elements
> such as textarea and input.
>
> <span class="myclass"><textarea>txt</textarea></span>


I presume that this is a highly simplified example. As it standards
it's both invalid HTML and a pointless use of the span element.

> So if "myclass" specifies "color:blue" I would expect the text in the
> textarea to be blue. But it isn't - at least not in the browsers I
> have tried (firefox, opera, ie).


What colour would you expect this to be?
<span class="myclass"><a href="foo">txt</a></span>

The default value for color is inherit. This means that if the child
element does not have an explicit color set anywhere in the cascade
then it will inherit the colour of the parent element.

Note the "anywhere in the cascade". The browsers have a default
stylesheet. You can see the default stylesheets for Firefox in the /
res/ folder. These defaults are setting the color property of the
textarea element.

You can make the colours for the form fields explicit
.myclass, .myclass textarea, .myclass input {color: blue;}
.myclass {other styles}

Or you can set them to inherit
textarea, input {color: inherit}

I would probably go for the former option as the inheritence may pop
up to surprise you later on.

Steve
  Réponse avec citation
Vieux 10/03/2008, 19h19   #3
Jukka K. Korpela
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Form element inheritance

Scripsit jjamjim@yahoo.com:

> I have a problem with styles not being inherited into form elements
> such as textarea and input.


Korpela's 1st law of CSS misunderstanding: any question containing the
word "inherit" or its derivative is based on a deep misunderstanding of
inheritance, cascade, and something else.

> <span class="myclass"><textarea>txt</textarea></span>


Why the pointless <span>, why the invalid <textarea> markup, and where's
the URL?

> So if "myclass" specifies "color:blue"


Then it's clueless. Write 100 times: blue means link. Then stop using
color: blue even in examples, since it's a _bad_ example.

> I would expect the text in the
> textarea to be blue.


That's because you don't understand inheritance.

> But it isn't - at least not in the browsers I
> have tried (firefox, opera, ie).


So what? If they have a browser style sheet that sets textarea color to
pink (or something else), textarea won't possibly _inherit_ color.

> I've had a good look
> through the css specification, but couldn't find anything about
> elements not inheriting styles.


Where did you read about elements inheriting styles?

They don't. An element _may_ inherit a value for a _property_, but only
if absolutely _no_ style sheet being applied sets that property for that
element.

> I have tried duplicating the class on the form element:
>
> <span class="myclass"><textarea class="myclass">txt</textarea></span>


What's the point of the <span>?

> That's better, but relative size properties cause problems. If
> "myclass" has font-size:200%. The textarea font would actually turn
> out 4 times the size.


Of course. When you set font size in %, you need to consider the effects
of nesting.

> So are the browsers incorrectly implementing the spec?


Yes, but that's not important right now.

> Or am I missing something.


Yes.

If you want to set the color of an element, set it, instead of setting
the color of an enclosing element.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

  Réponse avec citation
Vieux 11/03/2008, 02h14   #4
Harlan Messinger
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Form element inheritance

dorayme wrote:
> In article <YYeBj.308747$To6.7508@reader1.news.saunalahti.fi> ,
> "Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote:
>
>> Scripsit jjamjim@yahoo.com:
>>
>>> I have a problem with styles not being inherited into form elements
>>> such as textarea and input.
>>> I would expect the text in the
>>> textarea to be blue.

>> That's because you don't understand inheritance.

>
> Never mind that this fact could not possibly have escaped the OP.


I'm thinking we should have a special doctype for Usenet messages,

<!DOCTYPE kul PUBLIC ...>

indicating that the document is intended to conform to the Korpela
Usenet Language. Anyone who actually wants his Usenet posting validated,
not just for adherence to basic precepts of courtesy and netiquette as
well as reasonable standards for sincerity, good will, and having done
one's homework, but for conformance to all 358,392 rules of the Korpela
Posting Protocol, can use this document type declaration and expect a
detailed analysis and critique. Those who choose to dispense with this
treatment can leave out the declaration, posting in KUL quirks mode and
hope that they will be spared the gauntlet. Does this sound like a
suitable convention?
  Réponse avec citation
Vieux 11/03/2008, 03h29   #5
Ed Mullen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Form element inheritance

Harlan Messinger wrote:
> dorayme wrote:
>> In article <YYeBj.308747$To6.7508@reader1.news.saunalahti.fi> ,
>> "Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote:
>>
>>> Scripsit jjamjim@yahoo.com:
>>>
>>>> I have a problem with styles not being inherited into form elements
>>>> such as textarea and input.
>>>> I would expect the text in the
>>>> textarea to be blue.
>>> That's because you don't understand inheritance.

>>
>> Never mind that this fact could not possibly have escaped the OP.

>
> I'm thinking we should have a special doctype for Usenet messages,
>
> <!DOCTYPE kul PUBLIC ...>
>
> indicating that the document is intended to conform to the Korpela
> Usenet Language. Anyone who actually wants his Usenet posting validated,
> not just for adherence to basic precepts of courtesy and netiquette as
> well as reasonable standards for sincerity, good will, and having done
> one's homework, but for conformance to all 358,392 rules of the Korpela
> Posting Protocol, can use this document type declaration and expect a
> detailed analysis and critique. Those who choose to dispense with this
> treatment can leave out the declaration, posting in KUL quirks mode and
> hope that they will be spared the gauntlet. Does this sound like a
> suitable convention?


Nah. He'll Still be annoying.

Doesn't matter, even, if he's right. He'll still be annoying. And his
annoyance factor will still prevent his message from being heard and
understood.

He is his own worst enemy. He is smart, well documented, usually
salient, and insulting.

Have i ever learned anything from him? Yep. Do I mostly ignore his
posts? Yep. For the same reason I tune out people who yell at me on
street corners. They may have a valid point of view. It is their
presentation that off-puts.

Yukka will never be nominated for Ambassador of Anything.

Oh, well, maybe "Ambassador to "Insultingland."

And the rest of the world will take as much heed of his remarks as
Ambassador to that mythical land as anything else.

Should we? No, probably not. We probably ought to attempt to sift
through all of his diatribes and insults and attempt to glean sense and
insight from them. But, you know? Who wants to? Who wants to take the
time? And effort? Especially when, if you wander around a bit, you can
find equally good answers offered up with less vitriol.

So. Hey, Yukka. Knock your socks off (an American expression) and
enjoy. Just be aware that your attitude guarantees that a large
percentage of readers are skipping over your posts simply because they
have your name on them.

Another American expression which, I'm pretty sure, has many similar
translations: You catch more flies with honey than vinegar.

Oh. Wait. My bad. Sorry. I forgot that you don't really care about
conversation and exchange of ideas. You just want to hear yourself
postulate and utter snippets of truisms.

Enjoy your status as an academic. Be safe in your world of regulations
and standards. Grin and enjoy.

The rest of us will just have slog on without you and your pedantic
approach to life.

Another American expression: "You dick-head."

Sigh. I am so sorry I succumbed to that urge. That was not nice. Oooo!
How Jukka-like! Ok! I'm in the groove!

Geez. And now I'm sorry I bothered to join in on this. Oh well. It
happened to hit at a time when I had the time and the pain meds are
kicking in.

He's still possessed of a very bad strategy. Meaning: He's still an
asshole.

--
Ed Mullen
http://edmullen.net
Why can we shop in a store but we can't store in a shop?
  Réponse avec citation
Vieux 11/03/2008, 06h16   #6
Petr Vileta
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Form element inheritance

Jukka K. Korpela wrote:
> Scripsit jjamjim@yahoo.com:
>
> Then it's clueless. Write 100 times: blue means link. Then stop using
> color: blue even in examples, since it's a _bad_ example.
>

Heh :-) My business pages have blue backgroud so my links can't be blue. What
next? :-)))
In other word: blue color is *not* intended for links, blue color is blue
color and nothing more. Or know you about some RFC or w3c or something where
is written "Links must be blue!" ?
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to <petr AT practisoft DOT cz>

  Réponse avec citation
Vieux 11/03/2008, 07h16   #7
Jukka K. Korpela
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Form element inheritance

Scripsit Petr Vileta:

> Jukka K. Korpela wrote:
>> Scripsit jjamjim@yahoo.com:
>>
>> Then it's clueless. Write 100 times: blue means link. Then stop using
>> color: blue even in examples, since it's a _bad_ example.
>>

> Heh :-) My business pages have blue backgroud so my links can't be
> blue. What next? :-)))


Just follow the clue.

> In other word: blue color is *not* intended for links, blue color is
> blue color and nothing more. Or know you about some RFC or w3c or
> something where is written "Links must be blue!" ?


Try CSS specifications for a starter. Or google for "links want to be
links".

Alternatively, ask a person who can see tell you what the default color
of links in graphic browsers is (if you are blind or colorblind).

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

  Réponse avec citation
Vieux 11/03/2008, 10h22   #8
Blinky the Shark
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Form element inheritance

Petr Vileta wrote:

> Jukka K. Korpela wrote:
>> Scripsit jjamjim@yahoo.com:
>>
>> Then it's clueless. Write 100 times: blue means link. Then stop using
>> color: blue even in examples, since it's a _bad_ example.
>>

> Heh :-) My business pages have blue backgroud so my links can't be blue. What
> next? :-)))


Pages that don't have a blue background.


--
Blinky
Killing all posts from Google Groups
The Usenet Improvement Project: http://improve-usenet.org
Blinky: http://blinkynet.net

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h05.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16159 seconds with 16 queries