본 사이트는 여러분의 사용자 경험을 개선하기 위해 유지 보수를 진행하는 동안 기능이 제한됩니다. 도움말로 문제가 해결되지 않고 질문을 하고 싶다면 Twitter의 @FirefoxSupport 및 Reddit의 /r/firefox 채널을 활용하세요.

Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

1, Strange formatting of <B> inside <PRE>, and 2, Unexpected formatting of bogus <D> element

  • 9 답장
  • 0 이 문제를 만남
  • 1 보기
  • 최종 답변자: Mark Filipak

more options

FFox 112.0.2 (64-bit) running in Linux Mint 20.3 Una.

1, Strange formatting of <B> inside <PRE>. When using the default monospace font inside a <PRE> element, adding <B> elements disrupts character spacing. A screen shot is attached. "wheat" & "purple" are the colors. They are set in a CSS file. Here is the source HTML:

<PRE class="white">
// (1/240) sec-per-char +-all-strides-------------------------->
<B class="wheat">24pps</B>                // <B class="purple">(Aa______)(Bb______)(Cc______)(Dd______)</B> source pps
<B class="wheat">_hpps(Aa..Dd)</B>        // <B class="purple">(A_______)(B_______)(C_______)(D_______)</B> source top hpps
                     // <B class="purple">(a_______)(b_______)(c_______)(d_______)</B>        bottom hpps
<B class="wheat">(AaBbBcCdDd)=60hpps</B>  // <B class="purple">(A_-20%)(B_________+60%)(C_-20%)(D_-20%)</B> target top hpps
                     // <B class="purple">(a_-20%)(b_-20%)(c_-20%)(d_________+60%)</B>        bottom hpps
<B class="wheat">]30'1.001htfps</B>       // <B class="purple">[A+a___][B+b___][B+c___][C+d___][D+d___]</B> target htfps
                     //                 ================         combed</PRE>

<This character spacing disruption is surely a bug.>

<2, Unexpected formatting of bogus <D> element.> elements to (bogus) <D> elements in the source HTML. The result? The colors were retained and the characters became aligned.>

<What do you think of 1 & 2? Can you test in other browsers -- I can't.>

<Thanks for Your Thoughts,> Mark.

FFox 112.0.2 (64-bit) running in Linux Mint 20.3 Una. 1, Strange formatting of &lt;B&gt; inside &lt;PRE&gt;. When using the default monospace font inside a &lt;PRE&gt; element, adding &lt;B&gt; elements disrupts character spacing. A screen shot is attached. "wheat" & "purple" are the colors. They are set in a CSS file. Here is the source HTML: <pre><nowiki><PRE class="white"> // (1/240) sec-per-char +-all-strides--------------------------> <B class="wheat">24pps</B> // <B class="purple">(Aa______)(Bb______)(Cc______)(Dd______)</B> source pps <B class="wheat">_hpps(Aa..Dd)</B> // <B class="purple">(A_______)(B_______)(C_______)(D_______)</B> source top hpps // <B class="purple">(a_______)(b_______)(c_______)(d_______)</B> bottom hpps <B class="wheat">(AaBbBcCdDd)=60hpps</B> // <B class="purple">(A_-20%)(B_________+60%)(C_-20%)(D_-20%)</B> target top hpps // <B class="purple">(a_-20%)(b_-20%)(c_-20%)(d_________+60%)</B> bottom hpps <B class="wheat">]30'1.001htfps</B> // <B class="purple">[A+a___][B+b___][B+c___][C+d___][D+d___]</B> target htfps // ================ combed</PRE> </nowiki></pre><br> <This character spacing disruption is surely a bug.> <2, Unexpected formatting of bogus <D> element.> <I accidentally changed the <B> elements to (bogus) <D> elements in the source HTML. The result? The colors were retained and the characters became aligned.> <What do you think of 1 & 2? Can you test in other browsers -- I can't.> <Thanks for Your Thoughts,> Mark.
첨부된 스크린샷

글쓴이 cor-el 수정일시

선택된 해결법

I came up with a workaround that doesn't depend on bogus elements.

I'll make all the diagrams entirely bold. Then, using a <B> element inside the diagram in order to change background-color won't screw up the vertical alignment.

Thanks for your help. Mark.

Case closed.

문맥에 따라 이 답변을 읽어주세요 👍 0

모든 댓글 (9)

more options

The problem statement above got slightly distorted because of formatting, but not badly. There appears to be no way to fix it. I can't find a way to edit the posting. Sorry.

more options

You can't expect that mixing bold characters and normal spaces take the same width because bold spaces have a width that matches the width of the bold character.

Does this also happen if you include the spaces within the <b></b> tags ?

<PRE class="white">
// (1/240) sec-per-char +-all-strides-------------------------->
<B class="wheat">24pps                </B>// <B class="purple">(Aa______)(Bb______)(Cc______)(Dd______)</B> source pps
<B class="wheat">_hpps(Aa..Dd)        </B>// <B class="purple">(A_______)(B_______)(C_______)(D_______)</B> source top hpps
                     // <B class="purple">(a_______)(b_______)(c_______)(d_______)</B>        bottom hpps
<B class="wheat">(AaBbBcCdDd)=60hpps  </B>// <B class="purple">(A_-20%)(B_________+60%)(C_-20%)(D_-20%)</B> target top hpps
                     // <B class="purple">(a_-20%)(b_-20%)(c_-20%)(d_________+60%)</B>        bottom hpps
<B class="wheat">]30'1.001htfps       </B>// <B class="purple">[A+a___][B+b___][B+c___][C+d___][D+d___]</B> target htfps
                     //                 ================         combed
</PRE>


// (1/240) sec-per-char +-all-strides-------------------------->
24pps                // (Aa______)(Bb______)(Cc______)(Dd______) source pps
_hpps(Aa..Dd)        // (A_______)(B_______)(C_______)(D_______) source top hpps
                     // (a_______)(b_______)(c_______)(d_______)        bottom hpps
(AaBbBcCdDd)=60hpps  // (A_-20%)(B_________+60%)(C_-20%)(D_-20%) target top hpps
                     // (a_-20%)(b_-20%)(c_-20%)(d_________+60%)        bottom hpps
]30'1.001htfps       // [A+a___][B+b___][B+c___][C+d___][D+d___] target htfps
                     //                 ================         combed

글쓴이 cor-el 수정일시

more options

You can find "Edit this question" under the "Question Tools" menu in the sidebar. For a reply, "Edit this post" is in the three-dot menu next to a reply.

more options

cor-el said

You can't expect that mixing bold characters and normal spaces take the same width because bold spaces have a width that matches the width of the bold character.

Pale Moon doesn't add space. It enboldens characters without taking up more space. I don't/can't run other browsers, so I don't know about them. That's why I asked users to try other browsers.

글쓴이 Mark Filipak 수정일시

more options

This might depend on the font that is used as some fonts may have a bold version that takes the same space as the normal version, but a bold font is usually wider than a normal font for readability. You can not know beforehand what font is used, so you need to ensure that the number of bold characters stays the same to ensure proper formatting.

more options

cor-el said

Does this also happen if you include the spaces within the <b></b> tags ?

I tried soooooo many workarounds. Yes, I tried putting everything in <B> elements having differing colors but that provoked other problems.

When I stumbled on (bogus) <D> element that 'fixes' the problem (even though a bogus element shouldn't do anything), and it worked for both Pale Moon (in Windows) and FFox (in Linux), well, I jumpped on it. Does a bogus <D> element also work for other browsers? I don't/can't know. Do you know whether I can rely on it?

PS: Simply changing the background colors is all I need. Do you know of an HTML element that doesn't also make other changes?

글쓴이 Mark Filipak 수정일시

more options

선택된 해결법

I came up with a workaround that doesn't depend on bogus elements.

I'll make all the diagrams entirely bold. Then, using a <B> element inside the diagram in order to change background-color won't screw up the vertical alignment.

Thanks for your help. Mark.

Case closed.

more options

You can use a SPAN to change the background color, so no need to use a B tag as that is meant to bold text.

more options

cor-el said

You can use a SPAN to change the background color, so no need to use a B tag as that is meant to bold text.

Using a <SPAN> inside a <PRE> causes too many other problems. Thank you for the suggestion though. -- Mark.