Domanda

As the title says i'm trying





for new lines in a buttons text but in IE10 it doesn't show, I can change the mode to IE9 and it does show. Ironically in View Source it shows as well it's just not rendered in the display. Any ideas I can't find a solution for 2 hours :)

This is an asp.net button using the following markup

<asp:Button ID="imgViewQuoteDocument" runat="server" Text="View Quote&#010;Document" ToolTip="View Quote Document" OnClientClick="return confirm_close();" />

It renders correctly in all browsers except IE10 which removes the entity reference but instead of inserting a new line just simply removes the reference leaving the buttons text as

"View QuoteDocument"

instead of

"Vew Quote
Document"

p.s. you do not need examples to answer why IE10 ignores HTML Entities, you either know because you've come across it before or you don't know. The site has degraded somewhat over the years.

È stato utile?

Soluzione

You can make either entity work as expected if you put it in a <pre> tag.

The <pre> tag is for preformatted text, so it will attempt to display normal plaintext conventions like newlines, multiple spaces, and so on...

I personally like to use the <pre> tag in conjunction with:

white-space: pre-line;

for more normal content box wrapping - but it will depend on your application I imagine...

example: https://jsfiddle.net/mhouser_nowmediagroup/m3ywpLj0/

Altri suggerimenti

In html there is no difference between a space, a tab and a new line. It is just whitespace. A break is achieved by the tag <br>.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top