0


how can i set properly the div tag. i have a code but there have a space.

this is my code in css

#admin-container {
	background-color: #fff ;
	padding: 5px;
	border-radius: 5px;
	border: 1px solid #000;
	width: 1100px;
	margin: auto;
	height: auto;	
}

#user-logout{
	padding: 8px;
	border: 1px solid #000;
	width: 154px;	
	}

#admin-title{
	position: relative;
	float: left;
	top: -38px;
	right: -175px;
	background: #fff;
	padding: 5px;
	width: 914px;  
	border: 1px solid #000;
	border-radius: 2px;
	height: 26px;
	
}
#postsidebar {
	padding: 5px;
	border: 1px solid #000;
	border-radius: 7px;
	background-color: #fff ;
	width: 159px
}
Attachments css_style.jpg 24.25 KB
2
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by Dandello
0

We need to see the html as well. Without knowing what's going where, all any of us can do is guess. There may be an empty paragraph hiding in there, your floats may not be cleared or are being cleared in something that's taking up space. You do have a margin:auto in #admin-container. That could have the browser trying to center that div both horizontally and vertically.

0

this is my code in html.

<?php
include 'connect.php';

if(loggedin())
{
	echo '<div id="admin-container"><div id="user-logout">'.$_SESSION['username']." | <a href='logout.php'>Logout</a></div>";
}else 
	header("Location: index.php");

?>
<html>
<head>
	<link rel='stylesheet' type='text/css' href='style-admin.css'>
</head>
	<body>
		<div id='admin-title'><a href='/zen/index.php'>Blog </a></div><!--admin title-->
	
	<div id='blockholder'>
<div id='sidebarleft'>
			<label class='sidebar'>Control</label>
			<hr>
			<ul>
				<a href='post.php'><li>All post</li></a>
				<a href='add_new_post.php'><li>Add New</li></a>
				<a href='categories.php'><li>Categories</li></a>
			</ul>
		</div>
		</div>	
		</div><!--admin container-->
	</body>
</html>
0

well, first

echo '<div id="admin-container"> <div id="user-logout"> '.$_SESSION['username']." | <a href='logout.php'> Logout</a> </div> ";

is going to print outside your html body. Plus you have 2 div starts in this section and one div end.

try something like

if(loggedin()){
     $head = "<div id='admin-container'> <div id='user-logout'> ".$_SESSION['username']." | <a href='logout.php'> Logout</a> </div></div> ";
}
else {
     header("Location: index.php");
     $head = "";
}
 
?>

then

<body>
<?php
echo "$head";
?>

Haven't tested it but it should get you closer.

Edited by Dandello: n/a

0

when you put the closing div tag of #admin-container this will be the result.
i print screen the result of your code.

[IMG]http://i1106.photobucket.com/albums/h365/EL_Geezer/divtag.jpg[/IMG]
http://i1106.photobucket.com/albums/h365/EL_Geezer/divtag.jpg

but if you remove that </div> tag of #admin-container on the top and place it to the end that will be the body of all div tags.

[IMG]http://i1106.photobucket.com/albums/h365/EL_Geezer/divtagresult.jpg[/IMG]

http://i1106.photobucket.com/albums/h365/EL_Geezer/divtagresult.jpg

Edited by luweegee: n/a

0
<?php
include 'connect.php';

if(loggedin())
{
	 $head = "<div id='admin-container'><div id='user-logout'> ".$_SESSION['username']." | <a href='logout.php'> Logout</a></div></div>";
}else {
	header("Location: index.php");
	echo "$head";
}
?>

<html>
	<head>
		<link rel='stylesheet' type='text/css' href='style-admin.css'>
	</head>
	
	<body>
		<?php
			echo "$head";
		?>
		
		<div id='admin-tite-holder'>
			<div id='admin-title'><a href='/zen/index.php'>Blog </a></div></div><!--admin title-->
				
				<div id='blockholder'>
					<div id='sidebarleft'>
					<label class='sidebar'>Control</label>
					<hr>
						<ul>
						<a href='post.php'><li>All post</li></a>
						<a href='add_new_post.php'><li>Add New</li></a>
						<a href='categories.php'><li>Categories</li></a>
						</ul>
					</div>
				</div>	
	
	</body>
</html>

Edited by luweegee: this is my html code

0

Please post the html as seen in your browser's "View Source", preferably both the 'logged in' and 'logged out' versions.

From the code above, there's no way to know what's in connect.php that may be adding code or what other things may be broken.

You didn't include the CSS for
#admin-tite-holder
#blockholder
or
.sidebar
so we can't see what they might be doing.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.