Last modified: 2008-08-25 10:14:48 UTC
1. css "display: inline" works only in blockquotes created using : or * or #. In plain paragraphs, line breaks are inserted before and after the inline element. In blockquotes created by the html blockquote tag, a line break is entered only before the inline element. 2. Negative top and bottom margin values work for table cells but not for DIVs in Internet Explorer, and they for DIVs but not for table cells in Mozilla. Both bugs are demonstrated at: http://en.wikipedia.org/wiki/User:Dan_Pelleg/Inline_element (I'm using this platform to report a bug, meaning "a defect in the software". If I'm in the wrong place, place point me to the right one!) Thanks Dan
Please say, for each error, what you input, what the actual result is, and what the expected result is. I have no idea what you think is happening or should be happening.
I enter: text before<div style="display: inline;>-inline-text-</div> text after I expect: text before-inline-text- text after I get: text before -inline-text- text after However, when I enter: *text before<div style="display: inline;">-inline-text-</div> text after It works, i.e. I get: * text before -inline-text- text after And it works well also when I replace the "*" with ":" or "#".
This is probably not avoidable. The parser has to know whether the element is block-level or inline-level, and if it thinks it's block-level it shouldn't add paragraphs around it. The parser can't possibly know what CSS style the element will have when viewed. You need to use <span> in this situation.
Thanks, please forgive my layman-ness; since your phrasing seems to be too technical for me to make sense of it I'll rephrase: how can I put a table into a text without line-breaks happening before and after it? - - Just to make sure my preceding query wasn't misunderstood: adding the style attribute "display:inline" to the table's style definition in the text's source thus: <table style="display:inline;"> always works in html-files (i.e., not on Wiki projects) viewed in Internet Explorer, Mozilla and Safari, it also works in Wikipedia, but only when the first character of the paragraph within which the table is placed is : or * or # (without them, line-breaks are added before and after the element, i.e. the attribute "display:inline" is ignored). Unless the "display:inline" attribute is non-standard, it would seem to me that Wiki has a bug here, but if I'm wrong, I would greatly appreciate it if you could explain the matter to me. By the way, exactly the same behaviour happens with <div> and <p>, including the fact that the inline property is always correctly displayed by Internet Explorer, Mozilla and Safari when viewing html-files (i.e., not on Wiki projects).
(In reply to comment #4) > Thanks, please forgive my layman-ness; since your phrasing seems to be too > technical for me to make sense of it I'll rephrase: how can I put a table into > a text without line-breaks happening before and after it? This should work: <div>Text <table style="display: inline-table;"><tr><td>Table cell</td></tr></table> more text</div> Not all browsers support inline-table. You could try inline as well, which seems to work, although I don't know why. > - - Just to make sure my preceding query wasn't misunderstood: adding the style > attribute "display:inline" to the table's style definition in the text's source > thus: <table style="display:inline;"> always works in html-files (i.e., not on > Wiki projects) viewed in Internet Explorer, Mozilla and Safari The markup that corresponds to the wikitext you want is this: <p>Text <table style="display: inline;"><tr><td>Table cell</td></tr></table> more text</p> This markup is invalid. <table> cannot be contained in <p>: <p> can only contain inline-level elements. Browsers may accept it, but it's still invalid. Therefore, the wiki refuses to do that, and generates this instead: <p>Text</p> <table style="display: inline;"><tr><td>Table cell</td></tr></table> <p>more text</p> which breaks it onto three lines. You have to override the automatic addition of <p> to get around this, by wrapping the line in some other tag like <div>, <blockquote>, etc. (which can have <table> inside it).
Thanks! Wrapping the text with <div> made it work, though only with "inline", whereas "inline-table" again causes line-breaks to be inserted before and after the table. So what works is only: <div>Text <table style="display: inline;"><tr><td>Table cell</td></tr></table> more text</div> Thanks again also for explaining the mode of operation. Out of plain curiosity: why this difference between what the <p> and <div> tags enable? By the way, inserting a table (or div) with "display: inline;" into a text wrapped with <blockquote> works only partially, i.e. it results in no line-breaks added after the element but with a line-break inserted before it.
The reason for the difference is because the XHTML 1.1 standard specifies that a <p> element must not contain anything but inline-level elements. Why that is, you'd have to ask the XHTML standards group. FWIW, I recall reading that later versions of the standard will be more generous with what's permitted in paragraphs. <blockquote> may work differently at the moment because our support for it is apparently buggy, divs are special-cased where they shouldn't be. See bug 6200. inline-table works fine for me in Firefox 3, but it may not work in some browsers.
I see. Thanks very much for your help!