Ok this is not to advertise my site at all (it's quite empty right now as i'm still working on the layout.

If you go to you'll see a black gap between my top section and my middle section, I've literally been searching for hours why it does this but i can't seem to find it :( please help.

(you can right-click source code for it)

There is some php in it

<?php


@(include('config.php')) OR die ('<b>config.php not found!</b>');

$links 		= '<b>News</b>';
$news 		= get_news();
krsort($news);

htmlhead($links);

	if (!empty($news))
	{
		print '	<TABLE WIDTH=750 BORDER=0 CELLPADDING=0 CELLSPACING=0>
			<TR>
				<TD colspan=7><br></TD>
			</TR>
		';
		
		foreach ($news as $text ) 
		{
			?>
			
			<TR>
			<TD WIDTH=40></TD>
			<TD WIDTH=670 valign=top>
			<br>
			<?=$text ?>	
			<br>
			</TD>
			<TD WIDTH=40></TD>
			</TR>

			<TR>
			<TD></TD>
			<TD>
			<br><hr>
			</TD>
			<TD></TD>
			</TR>
			<?php
		}
		print '</table>';
	}
	else print '';
		
htmlfooter(); 		
?>

and the include file

<?php

$web = 'http://www.webfire.biz';


define('USERNAME', 		'username');																
define('PASSWORD', 		'password');																
define('PAGE_TITLE', 	'Pektop');										
define('DATA_FILE', 	'content.dat');													
define('NO_NEWS', 		'There is currently no news');									
define('WELCOME', 		'<b>Newswriter Administration</b>');		



if (!is_writable(DATA_FILE)) die ('<b>'.DATA_FILE.' is not writable or does not exist!</b>');

function htmlhead($links='')
{
	?>
	
	<?php
	if ( $links == 'on')
	{
	?>
		<a href="<?=$_SERVER['file:///MacHD/Users/adriaan/Downloads/newswriter-1.5/PHP_SELF'] ?>?action=new" class="subnavi">Create News</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;
		<a href="<?=$_SERVER['file:///MacHD/Users/adriaan/Downloads/newswriter-1.5/PHP_SELF'] ?>?action=show" class="subnavi">Show News</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;
		<a href="#" onClick="help();" class="subnavi">Help</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;
		<a href="<?=$_SERVER['file:///MacHD/Users/adriaan/Downloads/newswriter-1.5/PHP_SELF'] ?>?action=logout" class="subnavi">Logout</a>
	<?php
	}
	else { print '<span class="subnavi">'.$links.'</span>'; }
	?>

	<?php
}

function htmlfooter($links='')
{
	?>
	
	<?php
}

function loginscreen()
{
	?>
	<TABLE height=200 WIDTH=750 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
	<TR>
		<TD height=35></TD>
	</TR>
	<TR>
		<TD WIDTH=370>
			<form action="<?=$_SERVER['file:///MacHD/Users/adriaan/Downloads/newswriter-1.5/PHP_SELF'] ?>" method="POST">
			<input type="hidden" name="action" value="login">
		</TD>
		<TD valign="middle" WIDTH=50>

			<b>Name:</b>
		</TD>
		<TD valign="middle" WIDTH=350>
			
			<input style="width:120px" type="text" size="20" maxlength="15" name="name">
		</TD>
	</TR>
	<TR>
		<TD WIDTH=370></TD>
		
		<TD valign="middle" WIDTH=50>
		
			<b>Pass:</b>
		</TD>
		<TD valign="middle" WIDTH=550>
	
			<input style="width:120px" type="password" size="20" maxlength="15" name="pass">
		</TD>
	</TR>
	<TR>
		<TD></TD>
		<TD></TD>
		<TD valign="middle" WIDTH=550>

			<input style="width:120px" type="submit" value="Login">
		</form>
		</TD>
	</TR>
	</TABLE>
	<?php
}

function get_news()
{
		$serialized = file_get_contents(DATA_FILE);
		return (empty($serialized))? FALSE : unserialize($serialized);
}

function save_news()
{
		global $news;
		ksort ($news);
		
		$data = serialize(array_values($news));
		$fp 	= fopen(DATA_FILE,"w+");
						fputs($fp,$data);
						fclose($fp);

		header("Location: ".$_SERVER['PHP_SELF']."?action=show"); 	
}	

?>

ofcourse the username/password are changed here :p

Dani AI

Generated

A quick placeholder fix mentioned by stopped the visible gap, but that kind of patch often just hides the real cause. Useful, durable debugging finds which element or rule creates the extra space and then applies a targeted CSS fix. The most reliable method is to use a browser inspector to see which box (element) actually occupies the gap, then check its computed margins, padding, borders and height.

A short checklist that reproduces what an experienced front-end developer would do:

  • Use DevTools to hover the area and inspect the DOM node that spans the gap; look at the computed box model.
  • Temporarily add visible outlines or background colors to nearby containers to reveal which element is contributing height.
  • Disable CSS rules one-by-one or remove suspect empty elements to isolate the cause.
  • Check for margin-collapsing behavior (first-child top margins can collapse through a parent); see MDN for details: .

Common, non-destructive fixes (add only after identifying the actual culprit):

/* simple clearfix for a container that needs to contain floats */
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}
/* to prevent a parent/child margin collapse without changing layout */
.parent {
  border-top: 1px solid transparent;
  /* or use overflow:auto; if appropriate */
}

For the nav behavior that noticed in Firefox, the usual causes are inline elements that change size or gain an outline/border on :hover, forcing neighbors to reflow. Making nav links consistent in box sizing (for example, display:block or fixed line-height/height and stable padding) prevents the shift. Migrating layout responsibilities away from presentational hacks and towards simple CSS layout rules will avoid both the gap and the hover-reflow problem.

Recommended Answers

All 6 Replies

Any chance of you being a little more specific as to which sections (putting Here1 and Here2 would have been very helpful).

Well, for a "quick fix"...
right after you middle div...
add a non breaking space...

<div id="middle">&nbsp;

Of course, it would help if you had a Doc Type, had a 0 (zero) for padding rather than an O (Capital letter o) etc. etc.

Pelase...
http://validator.w3.org
Use it to check as you build, saves lots of annoying little confusions.

commented: very helpfull +1

thank you very much for your assistance, the issue is solved. Also, I didn't know validator worked on php pages, thanks.

The Nav Bar at the top seems a little messed up in Firefox. When you hover over one of the links all of the links to the left of it change to underneath it and blink. Very annoying, unless of course its for the feel of the website. :)

yeah I'm still working on that, it's not supposed to happen :p

yeah I'm still working on that, it's not supposed to happen :p

Hehe. Ok then just thought I should mention it. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.