user3070434
user3070434

Reputation: 3

Linebreak after <div>

I want my <div> to behave the same way as an <h1> tag, so that everything after the <div> comes under it, without using the <br> tag.

Is there a way to do this only using CSS.

Upvotes: 0

Views: 246

Answers (1)

Poetro
Poetro

Reputation: 572

By default the div should behave the same way as the h1 except the h1 has some margin before and after it in most browsers. If you did change some attributes of the div, that can result in not working as expected.

To add the margin to your div use CSS like

div {
  margin: 1em 0;
}

Upvotes: 3

Related Questions