How come display: block; isn't needed here, or is it? Centering

I thought that when you center stuff, you’re supposed to add display block, but here it shows it working without it.

.wraph {
  position: relative;
  width: 584px;
  height: 584px;
  border: 3px solid #0059dd;
  box-sizing: border-box;
  margin: 0 auto;
}

That div is a block element by default so there is no need to declare it as display:block.

If it was an inline element (like a span) then you would need to declare it as display:block because dimensions would not apply either.

Please take some time to learn the fundamentals of html as this has been explained to you time and time again!

5 Likes

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