Re: [css-d] can CSS constitute an HTML error?
On 1/13/11 10:30 AM, Barney Carroll wrote: Regards, Barney Carroll I think I need another cup of coffee:-) . ~d -- http://chelseacreekstudio.com/ http://chelseacreekstudio.com/fa/ __ css-discuss [css-d@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] can CSS constitute an HTML error?
Colin (Sandy) Pittendrigh wrote: I interpret that to mean "inline elements may not contain block elements." That’s a correct conclusion regarding HTML markup. But it is a purely syntactic matter and as such completely external to CSS. You could apply CSS, for example, on a basic XML file with no document type definition, no nesting rules (apart from generic XML well-formedness constraints), with no such concept as “inline element” or “block element.” The HTML and CSS concepts (of “inline” and “block”) are independent of each other. There’s just the connection that when a CSS stylesheet is applied to an HTML document, certain HTML elements will have display: block by default. This can be characterized as applying default stylesheet. But with CSS and the display attribute we can change display from inline to block, or versa visa, for any element. Yes, and you can do such things e.g. for CSS to be applied to a basic XML file (where all elements have display: inline unless you set otherwise). So, if my CSS says xx , is that an error of any kind? It does not violate any HTML or CSS specification. Whether it is an error or somehow questionable as a pragmatic issue is debatable. If you ask me, I would say that authors should usually avoid setting the display property of an HTML element to something that is not in harmony with its nature and properties as defined in HTML. But I wouldn’t go as far as saying that such settings are always wrong. For example, it is a common trick to set display: block for an image to avoid some undesired browser behavior. -- Yucca, http://www.cs.tut.fi/~jkorpela/ __ css-discuss [css-d@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] can CSS constitute an HTML error?
Hiya Sandy. CSS can't create an HTML error: if your HTML is well-formed and valid, then the resources it calls can have all sorts of inconsistencies and failings that may affect the eventual whole package of the rendered page, but the HTML itself will remain well-formed and valid. Using CSS to instantiate a block level element nested inside an inline element as you describe violates core concepts of the box model, and will lead to erratic & unpredictable rendering, so I wouldn't recommend it. Making traditionally inline elements display as block-level elements is not a problem if their immediate container element is also block-level. So the following examples, while exotic, will not cause errors layout errors: Setting navigation links as block-level elements is particularly popular. Regards, Barney Carroll barney.carr...@gmail.com 07594 506 381 On 13 January 2011 15:13, Colin (Sandy) Pittendrigh < sandy.pittendr...@gmail.com> wrote: > I found the following on the net: > > *Content model* > > Generally, block-level elements may contain inline > elements and other block-level elements. *Generally, inline elements may > contain > only data and other inline elements.* Inherent in this structural > distinction > is the idea that block elements create “larger” structures than inline > elements. > > I interpret that to mean "inline elements may not contain block elements." > > But with CSS and the display attribute we can change display from inline to > block, or versa visa, for any element. So, if my CSS says style="display: block;"> xx , is that an error of any kind? And if so, > it it an HTML error or a CSS error. I tried to look this up W3.org, but > I'm > going to have to work on those grammar-like specifications. They are not > easy for beginners to read. > > -- > > /* Colin (Sandy) Pittendrigh >--oO0> */ > __ > css-discuss [css-d@lists.css-discuss.org] > http://www.css-discuss.org/mailman/listinfo/css-d > List wiki/FAQ -- http://css-discuss.incutio.com/ > List policies -- http://css-discuss.org/policies.html > Supported by evolt.org -- http://www.evolt.org/help_support_evolt/ __ css-discuss [css-d@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
[css-d] can CSS constitute an HTML error?
I found the following on the net: *Content model* Generally, block-level elements may contain inline elements and other block-level elements. *Generally, inline elements may contain only data and other inline elements.* Inherent in this structural distinction is the idea that block elements create “larger” structures than inline elements. I interpret that to mean "inline elements may not contain block elements." But with CSS and the display attribute we can change display from inline to block, or versa visa, for any element. So, if my CSS says xx , is that an error of any kind? And if so, it it an HTML error or a CSS error. I tried to look this up W3.org, but I'm going to have to work on those grammar-like specifications. They are not easy for beginners to read. -- /* Colin (Sandy) Pittendrigh >--oO0> */ __ css-discuss [css-d@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/