1

Also, what would you use if it was an inline-block?

<div style='display:block; width: 300px; height: 24px;background-color:#E2AB58'></div>

<span style='display:block; width: 300px; height: 24px;background-color:#E2AB58'></span>

2 Answers2

1

You can use one of them according to how much data you want to display in this For better explanation check this one What is the difference between HTML tags <div> and <span>?

Community
  • 1
  • 1
Nishant Dixit
  • 5,388
  • 5
  • 17
  • 29
0

A div tag, because you have display: block in your style, which you can then remove; a div is a block level element, while a span is an inline element.

Anthony Astige
  • 1,919
  • 1
  • 13
  • 18
  • I would say in this context with `block` use div. An `inline-block` (which the original question did not say anything about) is a different thing, and somewhat inbetween the two (more nuanced which one to use). You can technically use just about any element in any case, but keeping them as similar to their original definitions is helpful to keep your code understandable. – Anthony Astige Jun 29 '16 at 04:40
  • I wouldn't say one is better than the other for `inline-block`s, but more up to other context. If I was forced to choose one with no other information I'd choose a span for an `inline-block`, but I don't have a lot of justification for that just a gut feeling. – Anthony Astige Jun 29 '16 at 04:43