Questions tagged [pre]

The

 element in HTML represents preformatted text. Text within this element is typically displayed in a non-proportional font exactly as it is laid out in the file. Whitespaces inside this element are displayed as typed. It is usually used for showing computer code or output.

The <pre> element in HTML represents preformatted text. Text within this element is typically displayed in a non-proportional font exactly as it is laid out in the file. Whitespaces inside this element are displayed as typed. It is usually used for showing computer code or output.

384 questions
15
votes
3 answers

How to display special unicode characters using monospace font in HTML with preserved character width

I'm using pre element to display some text including special unicode characters (⚡ ⚑ ▶ ◀ ⁋). I noticed that browsers render these special characters wider than regular ones, occupying more space horizontally. This can be easily seen here:…
ku1ik
  • 1,848
  • 22
  • 20
14
votes
8 answers

How can I display html tags inside an HTML document?

I simply want to create something like that: blah blah I've been trying to do this for a long time though for some reason whenever I put the code and the pre tags they don't do what they should. They do unformat the content - I…
Ariel
  • 2,638
  • 4
  • 23
  • 27
13
votes
3 answers

HTML justify text-align with
 tag

I have a problem with the text-align "justify" inside a paragraph with format and fixed width, because I want the paragraph text in HTML to appear totally justified (like it would happen with a MS Word file). However, this does not happen. What I…
julianfperez
  • 1,726
  • 5
  • 38
  • 69
13
votes
1 answer

Is it possible to use an tag within a
 tag?

Im working with some legacy code that generates a given message on a webpage but surrounds it with a
 tag - I was hoping to put a link (anchor tags) within it like this:
User created successfully - click here to…
Jimbo
  • 22,379
  • 42
  • 117
  • 159
12
votes
4 answers

Using
 and  tags to display a javascript script

I'm experimenting with the < pre> and < code> tags in html 5 as I would like to include some code snippets on my website. I'm using the page below as a test page but it is not displaying anything. Any reason why?
jezzipin
  • 4,110
  • 14
  • 50
  • 94
11
votes
2 answers

Break a text line inside a
 tag

I have a screen shot of my code snippet in chrome: and in firefox: My question is, how do I make the same effect in firefox as it was in chrome? the code snippet part is inside a pre tag. thanks a lot for any help! :)
Emkey
  • 5,346
  • 8
  • 38
  • 55
11
votes
2 answers

Center
 Block Without Centering Text

If I wanted to print code on an HTML page, but I want the
 block to be centered, but the actual text to be left aligned, how is this done?
Just to make it simple, what would it take to get this to center so that both lines start at the same…
markzz
  • 1,185
  • 11
  • 23
10
votes
2 answers

Setting PRE tab width in different web browsers

There's a way to set PRE tab width in Firefox and Opera, but there isn't a well-known way to do this in IE or Chrome, and hard-tabbed code in PRE tags suffers as a result. pre { white-space: -moz-pre-wrap; white-space: -pre-wrap; …
mcandre
  • 22,868
  • 20
  • 88
  • 147
9
votes
3 answers

Simple HTML Pretty Print

http://jsfiddle.net/JamesKyle/L4b8b/ This may be a futile effort, but I personally think its possible. I'm not the best at Javascript or jQuery, however I think I have found a simple way of making a simple prettyprint for html. There are four…
James Kyle
  • 4,138
  • 4
  • 28
  • 41
9
votes
1 answer

Code block formatting issues with Bootstrap and Pandoc

I have a code block in a Pandoc markdown file designated as: ```python for x in range(10): print('id is', x) ``` When I use the command pandoc example.md -s -o example.html I get the following output in a web page: However, when I use a custom…
wigging
  • 8,492
  • 12
  • 75
  • 117
8
votes
3 answers

How to preformat inside textarea

I was wondering if it were possible to preformat text that is inside a textarea. Right now I have a textarea code that I want to add syntax highlighting and also add linenumbers so I am trying to wrap the text inside a pre tag. Is this correct or…
jmnwong
  • 1,577
  • 6
  • 22
  • 33
8
votes
1 answer

How to disable styling on
 in bootstrap

I am using HTML's
 to render my text as is with \n and spaces in a block. But bootstrap's default behaviour puts a 
 block in a bordered box with a grey background. I don't want that. I want it to displayed as plain text.
How to…
MohitC
  • 4,541
  • 2
  • 34
  • 55
7
votes
4 answers

setting loses caret position on
 element on pressing TAB key

I have pre with contentEditable="true" on my webpage and I am trying to make it append "\t" when I press . I found some other plugins for that but they were working only on