Re: May elements with display:inline contain children with display:block?

On Friday 31 May 2002 5:35 pm, Bert Bos wrote:
|  Steven Pemberton writes:
|  > I read and reread the relevant parts of
|  > http://www.w3.org/TR/REC-CSS2/visuren.html to try and answer this
|  > question, and couldn't find from the text any reason why not. May
|  > elements with display:inline contain children with display:block?
|
|  Yes, absolutely. I do this occasionally to get a displayed, centered
|  image:
|
|      img {display: block; margin: auto}
|
|      <p>Some text <img...> more text
|

But as far as I know, <p> is dispaly: block element, no?..
I believe question from Steven was about code like this:

<html>
<head><style type="text/css">
 .aa { color: green; wont-weight: bold }
</style>
</head>
<body>
<span class="aa">some text inside span now block element starts <p>new 
paragraph</p> and text continiues inside span block. Is this valid or not? 
</span>
</body>
</html>

And, to my best knowledge, this HTML is invalid

Besides, Steven was aksing about such example (testcase blow):
<html>
<head>
<style type="text/css">
 html { display: inline }
 body { display: inline }
</style>
</head>
<body>
<div>some text inside DIV block </div>
</body>
</html>

Is it valid? I guess, yes.
How it should be displayed? 
I don't know. :-(

|  There are implicit anonymous blocks before and after the real block,
|  around any inline elements that are siblings of the block. (It doesn't
|  matter whether that anonymous block actually exists, in the DOM or
|  elsewhere, since CSS doesn't allow you to set any properties on it
|  anyway.)
|
|  In HTML it is rare to have blocks inside inlines, but CSS was designed
|  to allow paragraphs interrupted by displayed material, such as quotes.
|  It would probably be a good idea to support that in XHTML:
|
|      <p>Some text before the quotation
|        <blockquote>"A famous quote"</blockquote>
|        and the text continues.</p>
|
|  Or mathematical formulas:
|
|      <p>Some text leading to a grand formula,
|       <math display=block>...</math>
|       after which the text continues.
|
|  > Or to put it another way, if in HTML <html> and <body> were
|  > display:inline, what would break?
|
|  Nothing would break, but some properties on html or body (such as
|  padding, border, line-height) would obviously have different effects.

But how browser will guess what is page's width? Where it should warp text (if 
it should at all)?

|
|  Bert

-- 

Vadim Plessky
http://kde2.newmail.ru  (English)
33 Window Decorations and 6 Widget Styles for KDE
http://kde2.newmail.ru/kde_themes.html
KDE mini-Themes
http://kde2.newmail.ru/themes/

Received on Wednesday, 19 June 2002 03:01:34 UTC