Inline entity form ajax
What about adding wrappers to the fields?

In your hook_form_alter:

$form['field_name']['#prefix'] = '&lt;div class="last"&gt;';
$form['field_name']['#suffix'] = '&lt;/div&gt;&lt;div class="clearfix"&gt;&lt;/div&gt;';


Check https://www.webomelette.com/drupal-form-api-prefix-suffix