Closed Bug 290536 Opened 20 years ago Closed 20 years ago

The   does not have a fixed width (justification spreads apart non-breaking space

Categories

(Core :: Layout, defect)

1.0 Branch
x86
Windows XP
defect
Not set
trivial

Tracking

()

RESOLVED INVALID

People

(Reporter: whitefire, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; pl-PL; rv:1.7.6) Gecko/20050321 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl-PL; rv:1.7.6) Gecko/20050321 Firefox/1.0.2

It is my strong belief that a hard space should have a specific, fixed width. It
is especially important if I sometimes want to indent a justified paragraph with
  sign. It can be worked around with another ways, but I find it really
annoying (especially since it works OK in IE).

Reproducible: Always

Steps to Reproduce:
1. Write &nbsp 3 times and than a few lines of any text in the html code. Have
the text justified.
2. Do it again, and again, using words of various length
3. Compare the two paragraphs. They are not indented in the same manner.
Actual Results:  
   adlfja dalfjk adfaldfjka dflal;dfjka dfl
 lakdfjadl f ladkfja; dlfk
       ladfjaldkfjaldfjal;df
    I guess it shows it

Expected Results:  
 adlfja dalfjk adfaldfjka dflal;dfjka dfl
 lakdfjadl f ladkfja; dlfk
 ladfjaldkfjaldfjal;df
 I guess it shows it
attach a testcase please
Difference that i can see is that the alignment of text (justify)doesnt work in
IE, therefore the differences in rendering?
Assignee: firefox → nobody
Component: General → Layout
Product: Firefox → Core
QA Contact: general → layout
Version: unspecified → 1.0 Branch
right, I see what you mean.

1.IE does not render justification
2.Opera renders it like you intended, I don't know if its right or wrong.

The block of spaces seems to be broken in single spaces with justification
between them

I don't know the W3C specs

to prevent an auto-resolve ->NEW
(it may take too long before someone has the time to lok at this)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: The &nbps; does not have a fixed width → The   does not have a fixed width
Comment on attachment 180878 [details]
this htm doc shows the point

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#99CCFF">
<b>OK, this is an example.</b> View the same in Internet Explorer and watch the
<i><b>buts</b></i> first column!<br><br><br>
<table>
<tr valign="top" align="justify">
<td width="350" align="justify">
<p align="justify">
This is a text with <b>exactly 4</b> non-breakable spaces at the beginning of
<b>each</b> line. It could be just one; I did 4 to make it more visible. The
<i>but</i> words are not aligned in the same manner.
<br><br><br><br><font color="#0033CC">&nbsp;&nbsp;&nbsp;&nbsp;<b>but</b> W woj.
slaskim we wprowadzeniu tego przepisu w zycie nie maja sobie równych policjanci
z Siemianowic Slaskich. Do tej pory zabezpieczyli 35 samochodów o lacznej
wartosci ponad 350 tysiecy zlotych!
<br>&nbsp;&nbsp;&nbsp;&nbsp;<b>but</b> Nie mamy poblazania dla drogowych
piratów,którzyjezdza na podwójnym gazie, zapewnia sierzant sztabowy Wladyslaw
Luberda, z sekcji ruchu drogowego Komendy Miejskiej Policji w Siemianowicach
Slaskich. Policjanci dogadali sie z tamtejsza prokuratura rejonowa, która w
najbardziej powaznych przypadkach z udzialem pijanych kierowców zgadza sie na
takie zabezpieczenia.
<br>&nbsp;&nbsp;&nbsp;&nbsp;<b>but</b> Od tej pory udalo nam sie zabezpieczyc w
ten sposób 35 samochodów. Prokurator w zasadzie nie odrzuca naszych wniosków.
Zawsze w takich sytuacjach kierowcy byli pijani, mieli w wydychanym powietrzu
ponad 1,4 promila, powodowali wypadki i kolizje, a przy okazji wielu wczesniej
odebrano uprawnienia do prowadzenia samochodów - wyjasniaja policjanci.
<br>&nbsp;&nbsp;&nbsp;&nbsp;<b>but</b> Na czym
polegazabezpieczenieZazwyczajkierowcymoga jeszcze dysponowac samochodem, ale
nie moga go sprzedac do czasu zakonczenia sprawy. A gdy w przyszlosci sprawca
nie bedzie chcial zaplacic na przyklad grzywny, co sie zdarza, pojazd pójdzie
pod mlotek - dodaje Wladyslaw Luberda.
<br>&nbsp;&nbsp;&nbsp;&nbsp;<b>but</b> See what I mean?</font></p>
</td><td width="20"></td>
<td width="350" align="justify">
     This is a <b>exactly</b> the same text the way it looks like in Internet
Explorer or text editors, but with indentations made in a different way. I had
to use the < p > tag, which also means I get an extra space between paragraphs.
All <i>but</i> words are aligned in the same manner.
     <br><font color="#0033CC"><p
style='text-align:justify;text-indent:9.0pt'><b>but</b> W woj. slaskim we
wprowadzeniu tego przepisu w zycie nie maja sobie równych policjanci z
Siemianowic Slaskich. Do tej pory zabezpieczyli 35 samochodów o lacznej
wartosci ponad 350 tysiecy zlotych! </p>
     <p style='text-align:justify;text-indent:9.0pt'><b>but</b> Nie mamy
poblazania dla drogowych piratów,którzyjezdza na podwójnym gazie, zapewnia
sierzant sztabowy Wladyslaw Luberda, z sekcji ruchu drogowego Komendy Miejskiej
Policji w Siemianowicach Slaskich. Policjanci dogadali sie z tamtejsza
prokuratura rejonowa, która w najbardziej powaznych przypadkach z udzialem
pijanych kierowców zgadza sie na takie zabezpieczenia. </p>
     <p style='text-align:justify;text-indent:9.0pt'><b>but</b> Od tej pory
udalo nam sie zabezpieczyc w ten sposób 35 samochodów. Prokurator w zasadzie
nie odrzuca naszych wniosków. Zawsze w takich sytuacjach kierowcy byli pijani,
mieli w wydychanym powietrzu ponad 1,4 promila, powodowali wypadki i kolizje, a
przy okazji wielu wczesniej odebrano uprawnienia do prowadzenia samochodów -
wyjasniaja policjanci. </p>
     <p style='text-align:justify;text-indent:9.0pt'><b>but</b> Na czym polega
zabezpieczenie? - Zazwyczaj kierowcy moga jeszcze dysponowac samochodem, ale
nie moga go sprzedac do czasu zakonczenia sprawy. A gdy w przyszlosci sprawca
nie bedzie chcial zaplacic na przyklad grzywny, co sie zdarza, pojazd pójdzie
pod mlotek - dodaje Wladyslaw Luberda. </p>
     <p style='text-align:justify;text-indent:9.0pt'><b>but</b> See what I
mean? </p></font>

</td>
</tr>
</table>
<br>Now, all this is really just a nuisance. I like to make indentations
because it is simply a correct language. It is correct both in English and
Polish (my own) language. Doing it with a non-breakable space is the simplest
way to do it. <br><br> But it should be handled correctly by the best browser
in the world!

</body>
</html>
(In reply to comment #5)
Aaah, sorry, I thought it would actually update my attachement. It shows the
point better. Because the problem is not with IE and the fact that it does not
render justification! It really is what I wrote: hard space is a hard space, it
should have a specific width depending only on the font size and type. 
We're just inserting word-spacing for justification _between_ the non-breaking
spaces.  We have existing bugs on that.... eg see bug 164700
Depends on: 164700
Summary: The &nbsp; does not have a fixed width → The &nbsp; does not have a fixed width (justification spreads apart non-breaking space
Whiteboard: DUPEME
I think that it is not a bug.
Because we should define that the NBSP is justifiable character.

For example:
"the CSS&nbsp;2.1 specification is...."

In this case, we should add extra space to SP and NBSP. for "beautiful" rendering.

If web page author hope to indent, he/she should use 'text-indent'.
(In reply to comment #8)
> I think that it is not a bug.

It is. It is not just the fact that a non-breakable space has a fixed width in
all  word processors. It is simply necessery. I know that you can use the
text-indent, but in my case - I can't do that, because I'm using my own "bullet"
(an image instead of &bull). And I need a fixed space AFTER the image, not before. 
So I say the &nbsp should behave like an ordinary letter, not a space.

Whitefire
<img src="bullet.png" style="margin-right: 2em;">Text.

Cannot solve your problem?
(In reply to comment #10)
> <img src="bullet.png" style="margin-right: 2em;">Text.
> 
> Cannot solve your problem?

:)))) It does. Thanks!

I somehow missed the fact that you can set a margin for an image to do this. And
thus my problem is solved (thx thx thx again), but I'm not really sure if it
shoould not be considered a bug anyway. What if I wanted to use, say, '&raquo;'
or '&ndash;' as a bullet? And isn't it sometimes easier to do such things with
'&nbsp'? 

It seems that I am something of an ignorant after all, but there may be more
people like me out there... Especially since it works with IE (not that I want
Microsoft's work to be a model of any kind).
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
So simple pattern is...

<span style="margin-right: 2em;">&ndash;</span>text.

but it is not smart.

I think that if '&ndash;' is only added in head of a paragraph,

p:first-letter{
  margin-right: 2em;
}

<p>&ndash;text.</p>

Or, if you allow the &ndash; is not rendered on IE,

p:before{
  content: "\2013"; /* &ndash; */
  margin-right: 2em;
}

<p>text</p>
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
-> INVA
Status: REOPENED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → INVALID
No longer depends on: 164700
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: