# I never know when to use div tags

**URL:** <https://forum.freecodecamp.org/t/i-never-know-when-to-use-div-tags/450031>\
**Category:** Curriculum Help\
**Tags:** html, css\
**Created:** [March 7, 2021, 7:12pm UTC](https://forum.freecodecamp.org/t/i-never-know-when-to-use-div-tags/450031 "2021-03-07T19:12:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gtrman97](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/gtrman97/32/208259_2.png) [@gtrman97](https://forum.freecodecamp.org/u/gtrman97)\
**Post date:** [March 7, 2021, 7:12pm UTC](https://forum.freecodecamp.org/t/i-never-know-when-to-use-div-tags/450031/1 "2021-03-07T19:12:40Z")

</div>

It seems like I should use them everywhere. Is there a good rule of thumb?

---

<div class="post-metadata">

**Author:** ![Roma](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/roma/32/112899_2.png) [@Roma](https://forum.freecodecamp.org/u/Roma)\
**Post date:** [March 7, 2021, 7:40pm UTC](https://forum.freecodecamp.org/t/i-never-know-when-to-use-div-tags/450031/2 "2021-03-07T19:40:22Z")

</div>

You can probably use semantic elements in place of some of the `div` tags.

---

<div class="post-metadata">

**Author:** ![bbsmooth](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bbsmooth/32/203556_2.png) [@bbsmooth](https://forum.freecodecamp.org/u/bbsmooth)\
**Post date:** [March 7, 2021, 8:52pm UTC](https://forum.freecodecamp.org/t/i-never-know-when-to-use-div-tags/450031/3 "2021-03-07T20:52:30Z")

</div>

> [@gtrman97](#):
>
> Is there a good rule of thumb?

Use the semantically correct tag whenever possible, but if there is no tag that fits what you need or you need the tag purely for styling then use a `<div>`.

---

<div class="post-metadata">

**Author:** ![gaac510](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/gaac510/32/188836_2.png) [@gaac510](https://forum.freecodecamp.org/u/gaac510)\
**Post date:** [March 8, 2021, 12:25am UTC](https://forum.freecodecamp.org/t/i-never-know-when-to-use-div-tags/450031/4 "2021-03-08T00:25:19Z")

</div>

You can learn a lot about the `<div>` tag by finding and clicking into it on [this page](https://developer.mozilla.org/en-US/docs/Web/HTML/Element).

Take particular note of the _usage note_ and _example_ section.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [September 6, 2021, 12:25pm UTC](https://forum.freecodecamp.org/t/i-never-know-when-to-use-div-tags/450031/5 "2021-09-06T12:25:54Z")

</div>

Closed on September 6, 2021, 12:25pm UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
