Fix HTML problems and remove inline style if empty