Why use a button tag instead of input?

When creating an application, developers and designers tend to invest to little time in a proper semantic (X)HTML structure.

The layout of your project probably won’t benefit from this and while SEO will, what makes it so important is that it simplifies your work  (or someone else’s in your team).

A good example is the use of <thead> and <tbody> tags inside tables. You can easily apply a different visual style to a table header without adding a class to the first row (thead tr {background-color: #ccc;}).

Another one is the use of <button type=”submit”> tags over <input type=”submit”>. When applying CSS styles, you will be able to style buttons separate of input fields. Can you see the advantage?


Tags: ,

 
 
 

Leave a Reply