|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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/ |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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> |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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/ |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 |
|
![]() |
| Outils de la discussion | |
|
|