php在html页面中创建额外的空间 [英] php creating extra space in html page

查看:48
本文介绍了php在html页面中创建额外的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Web开发的新手,我真的对这个愚蠢的问题感到困惑.当我在html代码之前插入php代码时,如下所示:<?php ...一些代码...?><!doctype html>< html> ... 我的页面上方有多余的空白,并向下推动"整个内容.是否有可能避免创建额外的空间?如果php代码位于html的主体部分,它还会留出额外的空间,例如,如果它位于两段之间,则会在这两段之间创建额外的空间.感谢您的回答!

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!

推荐答案

我猜这会发生什么

您这样的代码

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

您应该像这样

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

这篇关于php在html页面中创建额外的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆