I'm not able or maybe I didn't get the way, to give size and other features to my form fields. I use #size and #maxlenght but after in the html they are different from mine.
Here my form code

  $form['ditta'] = array(
    '#type' => 'fieldset',
    '#title' => t('Frontespizio del registro di carico e scarico'),
    '#tree' => TRUE,
  );
  $form['ditta']['nome'] = array(
    '#type' => 'textfield',
    '#title' => t('Ditta'),
    '#default_value' => $node->ditta
  );
  
  $form['ditta']['numero'] = array(
    '#type' => 'textfield',
    '#title' => t('num.'),
    '#default_value' => $node->ditta_num,
    '#size' => 3,
    '#maxlength' => 3,
    '#description' => t('numero civico della ditta')
  );

Here the result in HTML source

<div class="description">Tipologia di attività svolta</div>
</div>
<div class="container-inline"><div class="form-item">
 <label for="edit-registrazione-codrec">cod.:</label>
 <input maxlength="128" name="edit[registrazione][codrec]" id="edit-registrazione-codrec" size="60" value="" class="form-text" type="text">
 <div class="description">codice rifiuto</div>

thanks a lot

luca