Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: getting html characters to align

by tangent (Parson)
on Mar 07, 2019 at 02:44 UTC ( [id://1230993]=note: print w/replies, xml ) Need Help??


in reply to getting html characters to align

HTML does collapse whitespace, so if you have three spaces they will only display as one space. A common way to deal with that is to replace each space with the HTML entity  . Another way to preserve whitespace is to add white-space: pre; to your .hft-lines CSS definition. The problem with both of these is that each letter is not the same width so the columns will still not line up.

Another way would be to wrap your text in a <pre>..</pre> tag - this will preserve the whitespace and also the column widths, but it does that by using a mono-spaced font (one where each letter is given the same space), but this is usually not that pretty.

I think your best solution would be to use a table, where each letter, and space, is put in a single cell. A bit cumbersome but you will then be able to keep the nice font.

These modules both work with array of array structure:
Text::Table::Tiny
Text::Table::HTML

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1230993]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 04:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found