There is the following code, how to make the entire site clearly centered, without using the <center> and the table

<!DOCTYPE html><html><head><title>Ельцовка</title><meta charset=UTF-8><style> body { padding: 0px; margin: 0px; font-family: font } @font-face { font-family: font; src: url(font.ttf) } header { white-space: nowrap; margin-top: 20px } .nl{ color: #111; cursor: pointer; text-decoration: none; padding:2px 7px } article { text-align: justify; width: 350px } .b { width: 400px; } </style></head><body><div class=b><header><h1>Развлекательно новостной сайт села Ельцовки</h1></header><nav><a class=nl href=index.html>Домой</a><a class=nl href=photoendvideo.html>Фото & Видео</a><a class=nl href=news.html>Новости</a></nav><section><article><h1>Заголовок главной статьи</h1><p>В этом блоке будет располагаться главная новость дня, недели, месяца или года. Она должно вмещаться в блог и нести самое главное основной новости. Открывая новость, читатель должен будет узнать только подробности.</p></article> </section><footer><p>Шнайдер Владимир</p></footer></div></body></html> 
  • Entertaining-news - in my opinion you need a dash. - invincible

2 answers 2

I understand that div.b is a container of the entire page? for it, set the margin: 0 auto;

  • It turns out that the contents of the header tag are not in the center, and everything else in the center - VladimirVi
  • You need the header to be in the center and everything else is on the left edge of the header - VladimirVi
  • You add this style to the container for the entire page. it is centered on the center. - LeD4eG
  • Well, the question is how does it sound? - LeD4eG
  • 2
    This is due to the fact that h1 in the header is clearly wider than 400px . the rest of the content is centered. see what happens if you specify overflow: hidden for this h1 PS. I would also like to ask you to show respect to the people to whom you ask for help and not to write more code in one line. I don't have a compute kernel to understand this string of characters. - LeD4eG

This is what you need?