Saving space in html select tag

I have a list of strings that I would like to display in a select HTML object. The lines look something like this:

id - name - description

I would like the fields to align. In PHP, I use

sprintf ("%4s%10s%20s", $id, $name, $description);

which works great. The problem is that multiple spaces are condensed to 1 space in the selection list. I tried to use the CSS pre and white-space CSS properties in the select box, but this has no effect. Any suggestions?

+3
source share
7 answers

you should use  instead, they are inextricable spaces, so they will not break.

You can do:

str_replace(" ", " ", sprintf("%4s%10s%20s", $id, $name, $description));
+4
source

CSS, .   ( str_pad() sprintf()).

http://us3.php.net/str_pad

+3

& nbsp; HTML-.

0

,  , ; , , HTML-fu ...

0

html-.

0

, , :

 
0

 ?

  (Non-break space), ?

0

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


All Articles