html: check if styles is valid before using it