相同的CSS/HTML不同的结果?
问题描述:
我有一个HTML文件,我总是使用相同的标题(我包括它在每一个页面的顶部) 我用CSS样式这个头......相同的CSS/HTML不同的结果?
整体机身顶部有没有空间,这就是好。 现在我在index.php的页面顶部有空间,在contact.php顶部没有空格,虽然它有相同的标题和完全相同的CSS文件链接输入代码在这里。 ..
这怎么可能?
(对不起,坏的代码示例,但该网站是复杂的,以显示它...)
.body{
\t margin: 0 auto;
\t width:70%;
\t clear: both;
}
.mainHeader img{
\t width: 50%;
\t height: auto;
\t margin-top:0px;
\t margin-bottom:20px;
\t display: block;
\t margin-right:auto;
\t margin-left:auto;
}
//index file
<?php
include 'includes/overall/header.php';
?>
//contact file
<?php
include 'includes/overall/header.php';
?>
//header file
<html>
<head>
<title>Website Title</title>
<meta charset="UTF-8" >
\t <link rel="stylesheet" href="css/style.css"/>
\t <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body class="body">
<header class="mainHeader">
\t <img src="logo.png"></img>
<nav>
\t <ul>
\t \t <li class="#"><a href="index.php">home</a></li>
\t <li class="#"><a href="contact.php">contact</a></li>
\t </ul>
</nav>
</header>
</body>
</html>
答
只要我们没有看到所有的代码包含的php文件,我们只能猜测。 谈到CSS,您可能会尝试在您的项目中使用“重置CSS”文件。重置CSS是一个css代码,用于清除页面中元素的所有边距,填充等。你可以到这里看看http://cssreset.com/scripts/eric-meyer-reset-css/
和代码是在这里:
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
所以,也许试一试,看看它是如何去。
+0
感谢您的快速回复,但它并没有帮到我很多......我发现问题是,Chrome浏览器在我的身上搜索了一个用户代理sylesheet ......它是有线的,它只是一些网页...你有一个想法如何删除身体上的用户代理样式表?谢谢你......马吕斯 – Marius
无法分辨实际的源文件。在开发人员控制台中查看您使用的任何浏览器,查看应用的填充和边距以及相关的样式。某处有些不同之处。 – junkfoodjunkie
摆脱'',图像标签不会关闭。 – tomaroo
对不起,我不是一个PHP的人,但你的头包含'html','head'和'body'标签似乎很奇怪。我认为这些包含的内容被认为是部分的意见。另外,不要使用隧道视觉......问题可能不在于头文件或头文件CSS,而可能是index.php页面上的标记(如一个流浪字符或无效标记)或该页面样式。 – zgood