php creating extra space in html page

半腔热情 提交于 2020-01-04 04:33:50

问题


I'm new to web development and I'm really stuck with this silly problem. When I insert php code before html code, something like this: <?php ...some code... ?><!doctype html><html>... it creates extra blank space on top of my page and 'pushes' whole content down. Is it possible to somehow avoid creating that extra space? It also makes extra space if the php code is in body part of html, for example if it's in between two paragraphs it will create extra space between that two paragraphs. Thanks for your answers!


回答1:


I guess this what happens

Your code like this

<?php
//your php code here
?>
<!DOCTYPE html PUBLIC "

You should have it like this

<?php
//your php code here
?><!DOCTYPE html PUBLIC "


来源:https://stackoverflow.com/questions/8045435/php-creating-extra-space-in-html-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!