What is the difference between HTML tags div and span?

A lot of people ask me this question so often, so I have come to address this here in this blog on the difference between the div tag and span tag which has really been confusing to most people. Below I have Just the right answer you will need to the problem you have.

If for instance At the top of my page, I have a logical section, the “header”. Since this is a section, I use a div (with an appropriate id). Within that, I have a couple of sections: the user bar and the actual page title. The title uses the appropriate tag, h1. The userbar, being a section, is wrapped in a div. Within that, the username is wrapped in a span, so that I can change the style. As you can see, I have also wrapped a span around 2 letters in the title – this allows me to change their color in my stylesheet.

Also note that HTML5 includes a broad new set of elements that define common page structures, such as article, section, nav, etc.

I hope this was helpful 🙂 .