carattere Monospace in IE8 ignora gli spazi
-
25-10-2019 - |
Domanda
Sto cercando di ottenere un lavoro tavolo ASCI spaziatura fissa, come si vede qui:
tag e css font-family
Questo funziona per me su tutti i browser, ad eccezione di IE8.
In IE8, gli spazi tutti ottenere compressi in un unico spazio. (Così le colonne scompaiono)
Tutte le idee sul perché IE8 sta facendo questo?
Grazie in anticipo,
Alex
Soluzione
white-space:pre
per il vostro elemento per preservare spazi vuoti.
Altri suggerimenti
HTML default behaviour is to compress multiple white spaces down to a single space, unless explicitly told not to.
The way to tell it not to do this is to use the CSS white-space
property. The value you're probably looking for is to set it to white-space:pre;
, which will set a element to display all white space without compressing it.
You can of course also use the <pre>
tag itself, which has white-space:pre;
set by default. Note that this can be overridden in your stylesheets, so if a <pre>
tag isn't working, this is probably the reason. (if this is happening, you can use the Developer Tools window to examine the styles being applied to the element)
In addition to white-space:pre;
, there are a couple of other values of the white-space
property which you can also use, depending on your requirements: pre-wrap
and pre-line
.
You can find out more about the differences between them, with examples, here: http://www.quirksmode.org/css/whitespace.html
Hope that helps.
I have tried this and it worked... (perhaps it helps) Then, fix the rest with styles.
<svg width="600" height="150" font-family="monospace" xml:space="preserve">
<defs>
<style type="text/css">
<![CDATA[ /* ADD CLASSES */
.font{text-anchor: start; font-size: 12px;font-weight: normal; font-family: "DejaVu Sans Mono", sans-serif;white-space: pre-wrap;}
]]>
</style>
</defs>