Google Finance - Get Quotes search box - Column Alignment

By : BCS

How does Google manage to properly align the second column (i.e. the ticker name) in the "Get Quotes" search box suggestion dropdown in

Example: If you enter "iii" - the second column is perfectly aligned.

It does not use a fixed-width font - so just adding the correct numbers of spaces to the "ticker" will not work.

How do they do that?

By : BCS


I just viewed source with a DOM inspector and it appears that they are spans for each cell with a margin set (as Darren said) to position the right column over.

By : travis

most likely just using margins. float the first column left then set the margin to the width of the first column.

The answer provided by nlucaroni will only work for positive numbers. A possible solution that works for both positive as well as negative numbers is:

$x = $x - intval($x)

This video can help you solving your question :)
By: admin