Closed Bug 271227 Opened 20 years ago Closed 20 years ago

Forced line breaks (e.g. <br/>) disappear in display: -moz-inline-box (everything on one line)

Categories

(Core :: Layout: Block and Inline, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bugzilla, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8a5) Gecko/20041121 Firefox/0.9.1+

When looking for "display: inline-block" functionality i stumbled upon "display:
-moz-inline-box". This seems to do the trick and is much 'cleaner' than float:
left/overflow: auto (which have their own problems like unpredictable scrollbars
and non-collapsable paddings/margins, etc.) However, using moz-inline-box <br/>
tags don't produce line breaks anymore.


Reproducible: Always
Steps to Reproduce:
Try this piece of HTML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">  
div.row {
 width: 100%;
 border: 3px solid black;
 background-color: #a0a0a0;
}
.col {
 width: 49.9%;
 border: 0.01em solid red;
 display: -moz-inline-box;
 display: inline-block;   
 vertical-align: top;
}
</style>
</head>
<body>

<div class="row">
<span class="col">
Hello world<br/>
(in A SPAN within a DIV).
</span>  
<span class="col">And another 'column'</span>

</div>

</body>
</html>

Actual Results:  
"Hello world" and "(in A SPAN within a DIV)" appear on the same line.


Expected Results:  
A (forced) line break should be present between "Hello world" and "(in A SPAN
within a DIV)".
Comment on attachment 166770 [details]
example HTML shows BR's not displaying properly

changing mime type
Attachment #166770 - Attachment mime type: text/html → text/xml
Attachment #166770 - Attachment mime type: text/xml → text/html
dupe of bug 268477
(In reply to comment #3)
> dupe of bug 268477
Not really. That is, using <br> instead of <br/> (or <br /> or <br clear="all"/>
or whatever) still doesn't show the forced line break as it should (?).
> as it should (?).

That's the key question.  The only documentation I can find for this internal
value is the code itself.... that is, whatever it does is correct by definition.

It looks like it acts mostly like -moz-box except it doesn't count as a block
"from the outside".  Does <br> work in a -moz-box?
No, it does not. In fact, I was surprised that text worked at all. In a XUL
document it should be necessary to wrap all text in a label or description.

You can solve this problem using XHTML or XBL. Since you want this to work in
other browsers I suggest you use XBL. Create the following XML document:
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl">
  <binding id="description" extends="xul:description"/>
</binding>
Then use -moz-binding: url(description.xml#description); in your style sheet.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Whoops, I accidentally omitted the namespace declaration for XUL
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: