<form>
  
  <div>
    テキスト
    <input type="text" minlength="3" maxlength="10"/>
  </div>
  
  <div>
    <div>テキストエリア</div>
    <textarea minlength="3" maxlength="10" cols="30" rows="10"></textarea>
  </div>
  
  <button type="submit">送信</button>
</form>
input,
textarea,
select {
  &:valid {
    border: 1px solid green;
  }
  &:invalid {
    border: 1px solid red;
  }
}

// 案件上デフォルトのstyleで使われることがほぼないのでstyleは適当
[type='radio'],
[type='checkbox'] {
  &:valid {
    box-shadow: green 0px 0px 3px 1px;
  }
  &:invalid {
    box-shadow: red 0px 0px 3px 1px;
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.