Question

Hello I have designed a header for my website in Html. It works fine.I was having a BOM related issue in PHP which was solved using UTF-8 format hence I can include the header in any of my pages.  set has now disappeared but an empty white horizontal gap still exists above my header.How should i get rid of that ?

code for header.php page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> 
<title>Untitled Document</title>
    <link href="css/ssHeadFoot.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</head>
<body>

    <table class="style1" cellpadding="0" cellspacing="0">
        <tr>
            <td class="tdTop">&nbsp;
                </td>
        </tr>
        <tr>
            <td class="tdMenu" align="center">
                <ul class="ulMenu">
                    <li><a href="#">Home</a></li>
                    <li><a href="about.asp">About Us</a></li>
                     <li><a href="#">Products</a>
                        <ul>
                        <li><a href="#">Hardware</a></li>
                        <li><a href="#">Plywood</a></li>
                            <li><a href="#">Fabrication</a></li>                        
                            <li><a href="#">Others</a></li>
                        </ul>
                     </li>
                    <li><a href="Contact us.asp">Contact Us</a></li>
                   <li><a href="feedback.asp">Feedback</a></li>
                    <li><a href="login.asp">Log In</a></li>
                    <li><a href="sign.asp">Sign Up</a></li>
                </ul>

            </td>
        </tr>
    </table>

</body>
</html>

code for demo.php where header.php is included:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="css/ssHeadFoot.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include 'header.php'; ?>
</body>
</html>

output:

enter image description here

Was it helpful?

Solution

try this may work header.php page will be

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="css/ssHeadFoot.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- the other code for this page -->

and the main page will be

<?php include 'header.php'; ?>
</body>
</html>

some times it's work with me when do this

and try use require_once for the page so when the header.php is missing the code stop and if you include it again no error appear or page require twice

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top