Show spaces in parameter tag

I want to organize my list as follows:

Subject Chapter MCQ Duration(min) Physics 1 10 40 40 Chemistry 1 9 30 30 Math 1 10 40 40 Biology 1 12 40 20 

So, I tried the following:

 <div style="font-family: "Lucida Sans Unicode""> <?php include_once('funcs.php'); $f = new funcs(); $res = $f->get_ques(); printf("%-'.20s", 'Subject'); printf("%-'.20s", 'Chapter'); printf("%-'.20s", 'Marks'); printf("%-'.20s", 'Duration'); ?> <br/> <select> <?php while( $q = mysql_fetch_array( $res ) ) { echo '<option>', printf("%-'-20s", $f->get_sub($q['q_id'])), printf("%-'.20s", $q['chapter']), printf("%-'.20s", $q['mcq']), printf("%-'.20s", $q['time']), '</option>'; } ?> </select> </div> 

And my conclusion:

enter image description here

The lines are zigzag. I want these lines to be strict. I tried using a fixed-length font but could not. And I have to remove these points. also. Someone please help me.

+4
source share
3 answers

change this value

 echo '<option>', printf("%-'-20s", $f->get_sub($q['q_id'])), printf("%-'.20s", $q['chapter']), printf("%-'.20s", $q['mcq']), printf("%-'.20s", $q['time']), '</option>'; 

to

 echo '<option>', printf("% /&nbsp20s", $f->get_sub($q['q_id'])), printf("% /&nbsp20s", $q['chapter']), printf("% /&nbsp20s", $q['mcq']), printf("% /&nbsp20s", $q['time']), '</option>'; 

use   for space.

+3
source

You can use &nbsp; for spaces not - .

+1
source

Since such a thing with different types and fonts is impossible, since each character width is different from each other. There is only one way to do what you need. Parameters use a monospaced font courier or any other Monospaced font. I know that Courier has the same width of all characters. Just change the font name to courier and look at the thought you need.

Use a stylesheet to confirm that the identifier is being selected and selected, and describe CSS rules as:

  <select id=abc> <option id=abc> def </option> </select> 

and in css

  #abc {font-family:.......}. 

Will be allowed

0
source

All Articles