I took the liberty to format your code so it’s easier to see where an element starts and ends.
One of the two issues is this, I guess:
Code:
document.getElementById(shID).style.display = 'block';
If you display an element as block-level element it invokes a line break before and after itself.
Secondly, if you want centered text, don’t float it.
text-align: center is only working on inline content and not on elements that are floated, because these are basically behaving as block elements.