0

I have a very basic html code and all the elements are asigned to the left and my second paragraph is not displayed

#bar {
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}
<div id="bar">
  <h2>title</h2>
  <p>paragraphtext1</p>
  <img src="" alt="logo" />
  <img src="" alt="logo" width="720" />
  <img src="" alt="logo" />
  <img src="" alt="logo" width="720" />
  <img src="" alt="logo" />
  <p2>hi</p2>
</div>
David Thomas
  • 249,100
  • 51
  • 377
  • 410
  • 1
    There is no such element as a although the browser will probably still render it – lharby Jun 11 '22 at 16:55
  • "*my second paragraph is not displayed*" - first: you don't have a second paragraph, but the element you (possibly think is a 'second paragraph') is shown in the demo created from your posted code. – David Thomas Jun 11 '22 at 17:12

1 Answers1

0

To make align-items: center; justify-content: center; rules work, add display: flex; as well. If you just want to align items horizontally, you can use text-align: center; instead of those three rules. Also, p2 is not a valid HTML tag. Change it to p and it should work fine.

burkay
  • 1,075
  • 1
  • 10
  • 20