html element close properly in cross browser way