From the course: HTML Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Generic elements: div and span

Generic elements: div and span - HTML Tutorial

From the course: HTML Essential Training

Start my 1-month free trial

Generic elements: div and span

- So far we've talked about several dozen HTML elements that cover a wide range of semantic needs. But what about all the other times you need an element and there isn't one for that situation. Sometimes we just need a way to wrap a group of elements or to mark a phrase. Sometimes there is no meaning to it we just need a way to target part of the DOM with CSS or Javascript. Well there are two elements that you can use anytime none of the other elements make sense, div and span. Now, if you've been working as a developer writing HTML, you've likely seen these two elements. It's likely that you, or your colleagues are already using them. Perhaps a lot. Before 2010, before HTML 5 brought us so many of the semantic elements that we need, we used divs for all sorts of use cases. We used divs to create sections to make sidebars, we used divs to wrap everything to separate everything, div, div, div, div, div. People…

Contents