Jump to content

[SOLVED] Why is this not working?


SyncViews

Recommended Posts

Why is the "right:170px" ignored on the div#body?

 

Style sheet contents

div#body
{
background-color: #000000;
border-style: solid;
border-color: #009999;
border-width: 1px;
color: #CCCCCC;
text-align: center;
position: relative;
left: 160px;
right: 170px;
}

div#nav
{
float: left;
background-color: #000033;
border-style: solid;
border-color: #009999;
border-width: 2px;
color: #DDDDDD;
text-align: center;
width: 150px;
}

html page

<!--bunch of header stuff-->
<div id="nav">
  <!--Verticle nav bar-->
</div>

<div id="body">
  <!--lots of text-->
</div>

<!--footer-->

Link to comment
https://forums.phpfreaks.com/topic/80876-solved-why-is-this-not-working/
Share on other sites

Not sure how I'm meant to do absolute here. I don't know how "high" the body block will be because it is a php page and gets that from a data base and if I don't do abosulote with the footer as well it seems to put the footer "ontop" of everything else:(

 

anyway heres there entire page source.

All the formatting is done by CSS and the includes don't contain anything that should effect the positioning (eg main_nav.php only uses the "span.nav_..." stuff)

 

<?php
include ('./globals.php');
$page_name = 'Index';
$page_type = 1;
include ('./main_header.php');//includes <html>, <head> and <body>
//connects to data base ($con);
?>
<div id="nav">
<?php include ("./main_nav.php");?>
</div>

<div id="body">
<?php
$result = mysql_query("SELECT Text_1 FROM data WHERE ID=1");
if (!$result)
{
	exit (mysql_error());
}
$data = mysql_fetch_array($result);
echo $data['Text_1'];
?>
</div>

<div id="footer">
<?php include ('./main_footer.php');?>
</div>

</body>
</html>

 

and the CSS

body
{
background-color: #0000CC;
padding: 0
}

/*-------------------------*/
/*===========NAV===========*/
/*-------------------------*/
div#nav
{
float: left;
background-color: #000033;
border-style: solid;
border-color: #009999;
border-width: 1px;
color: #CCCCCC;
text-align: center;
width: 150px;
}

span.nav_header
{
text-decoration: underline;
font-weight: bold;
font-size: large
}

span.nav_home
{
font-weight: bold;
}

span.nav_result
{

}

/*--------------------------*/
/*===========BODY===========*/
/*--------------------------*/
div#body
{
background-color: #000000;
border-style: solid;
border-color: #009999;
border-width: 1px;
color: #CCCCCC;
text-align: center;
position: relative;
left: 160px;
right: 170px;
}

/*----------------------------*/
/*===========HEADER===========*/
/*----------------------------*/
h1.header_title
{
text-align: center;
text-decoration: underline;
font-weight: bold
}

/*----------------------------*/
/*===========FOOTER===========*/
/*----------------------------*/
div#footer
{
background-color: #000000;
border-style: solid;
border-color: #0011AA;
border-width: 1px;
color: #EEEEEE;
text-align: center;
width: 400px;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.