Help please, I looked up the page stumbled upon a strange indentation before the div. Also, the entire contents of the HEAD tag has moved to BODY. Strange indent

Page Code

<!DOCTYPE html> <?php include 'application/views/'.$content_view;?> <html> <head> <meta charset="utf-8"> <title><?php echo $title;?></title> <link rel="stylesheet" href="/css/style.css"> </head> <body> <div class="header"> Шапка </div> <div class="sidebar"> <div class="menu"> Меню </div> </div> <div class="content"> <?php echo $content ?> </div> <div class="footer"> Подвал </div> </body> </html> 

Styles:

 * { margin: 0; padding: 0; } *, *:before, *:after { -webkit-box-sizing: border-box; /* Нужно для мобильного WebKit */ -moz-box-sizing: border-box; /* Нужно для Firefox */ box-sizing: border-box; } body{ width: 100%; background-color: #E1E1E1; font-size: 1.15em; } .header{ min-height: 50px; margin-bottom: 5px; font-size: 1.75em; } .content{ width: 50%; min-height: 800px; margin: 0 0 0 30%; position: relative; display: inline-block; } .sidebar{ position: absolute; width: 14.55%; left: 14%; display: inline-block; } .footer{ margin-top: 5px; } .sidebar, .content{ background-color: #FFFFFF; border-radius: 1%; padding: 10px 15px; } .footer, .header{ position: relative; width: 100%; background-color: black; color: #D9D9D9; padding: 5px 0% 5px 2%; } .header:hover{ color: white; } 

What is wrong with the page ?????

  • Not sure what will help, but I would try <? Php include 'application / views /'.$ content_view;?> Move to line 10 (immediately after <body>) - Andy
  • As I have already found out from php inserts it does not depend. - Alexander Ryabikov
  • one
    If it’s not a matter of <? Php include 'application / views /'.$ content_view;?> - then the problem may be in the cache (try clearing the page cache) ... I tried to run your code at myself - everything works smoothly without php inserts - Andy
  • And I recommend adding <meta lang = "en"> - Andy
  • Without php inserts, there is also an indent - Alexander Ryabikov

1 answer 1

I had such a baida because of the UTF-8 encoding, it added some extra character to the top of the page. Try to recode in UTF-8 without BOM, in notepad ++ this is the easiest.

  • Nothing has changed ((( - Alexander Ryabikov
  • The problem was found in two UTF-8 coding w / o BOM UTF-8-BOM. It was correct to put the UTF-8 encoding. And the characters themselves go away - Alexander Ryabikov