Better positioning of cursor after change in CSS string values