Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Ce site disposera de fonctionnalités limitées pendant que nous effectuons des opérations de maintenance en vue de vous proposer un meilleur service. Si un article ne règle pas votre problème et que vous souhaitez poser une question, notre communauté d’assistance est prête à vous répondre via @FirefoxSupport sur Twitter, et /r/firefox sur Reddit.

Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

In code inspector, can <pre> contents be shown with line breaks and tabs applied?

  • 1 réponse
  • 1 a ce problème
  • 2 vues
  • Dernière réponse par Boogey

more options

I'm using <pre> to show my visitor's HTML code in my webpage. The code contains \t's (tabs) and \n's (line breaks), and seems to render fine in the webpage. As a test, I select all the code and paste it into various other apps, and formatting it maintained (good).

My issue is with how <pre> is displayed in the code inspector: <pre>'s content is shown on one line... the tabs and line breaks are not applied. Initially this made me second-guess my work and make me chase ghosts for awhile ("Where are these spaces coming from?").

Testing with Chrome, in the inspector, <pre> is shown with tabs and line breaks applied. It looks the same as in the webpage, so I don't second-guess it.

Overall this is a silly annoyance, however encountering this for the first time chewed up 30mins of my time. As well, I would expect, without formatting applied, that at least no extraneous spaces would be injected. If there's a space, to me that means I actually have a space inside my <pre> contents.

Let me know if I'm overlooking something!

I'm using &lt;pre&gt; to show my visitor's HTML code in my webpage. The code contains \t's (tabs) and \n's (line breaks), and seems to render fine in the webpage. As a test, I select all the code and paste it into various other apps, and formatting it maintained (good). My issue is with how &lt;pre&gt; is displayed in the code inspector: &lt;pre&gt;'s content is shown on one line... the tabs and line breaks are not applied. Initially this made me second-guess my work and make me chase ghosts for awhile ("Where are these spaces coming from?"). Testing with Chrome, in the inspector, &lt;pre&gt; is shown with tabs and line breaks applied. It looks the same as in the webpage, so I don't second-guess it. Overall this is a silly annoyance, however encountering this for the first time chewed up 30mins of my time. As well, I would expect, without formatting applied, that at least no extraneous spaces would be injected. If there's a space, to me that means I actually have a space inside my &lt;pre&gt; contents. Let me know if I'm overlooking something!
Captures d’écran jointes

Modifié le par cor-el

Toutes les réponses (1)

more options

FYI: I can't seem to edit my original post. In the first sentence of the post I mentioned line breaks and tabs, and I used slash-t and slash-n and looks like they got stripped in the post.

Also fixed the attachment image.

Modifié le par Boogey