CSS alignment

I need to align a row of rows using the style property

This is HTML code that is converted using XSL

<span style="white-space: pre; font-size: 8pt; font-family: Lucida console, Courier ">&lt;40 : item1</span><br> <span style="white-space: pre; font-size: 8pt; font-family: Lucida console, Courier ">40-80 : item2 </span><br> 

Need how to align elements like

 <40 : item1 40-80 : item2 

it currently looks like

 <40 : item1 40-80 : item2 

is this possible using the style property?

Using Internet Explorer version 6 and higher

+4
source share
5 answers

There is a char attribute for HTML td tags, however it is in no way supported as far as I know.

This is valid HTML:

 <table> <tr char="."> <td>11.10</td> </tr> <tr char="."> <td>111.20</td> </tr> <tr char="."> <td>15552.52</td> </tr> </table> 

I have used this workaround in the past:

http://krijnhoetmer.nl/stuff/javascript/table-align-char/

+2
source

use &nbsp; instead of spaces

0
source

sure that is possible. u can use

 <div style="float: left; width: 50px">&lt; 40</div><div style="float: left; ">:</div><div style="float: left; ">item 1</div> <span style='clear: left'></span> <div style="float: left; width: 50px"> 40</div><div style="float: left; ">:</div><div style="float: left; ">item 2</div> 

otherwise you can try

 display: table-cell; 

it can be added to the style.

0
source

white-space: pre; should do the trick and work in all browsers.

  • Do you get this error in every browser or just in IE?
  • Are there any other styles that affect these <span> elements?
  • Is it possible to change xsl to get different markup?
0
source

many options:

If you can wrap the range (ex 40-80) and the element name (ex item1) in a separate element, then specify the width for each.

Otherwise, specify white-space: pre so that spaces remain in the browser. Remember to use Monospace font so that each character occupies the same amount of horizontal space. Example: Console, Console Lucida, Mono Liberation, Deja Wu Sens Mono, Bitter Vera Sens Mono, Courier New, Monospire

0
source

Source: https://habr.com/ru/post/1342962/


All Articles