Div being ignored

R

Rigga

Hi,

I have created a page that builds up a table using data from a database and
formats the table using css tags.  I want to draw a coloured background
around my table (or just a portion of the scren that the table 'sits' on)
however when I isue the <div class="myclass"> in the php script it just
appears to ignore it.  I have included a snippet of my code below as this
will make it clearer:


All standard htm code at top of page, it then gets to the part where it
draws the table:

/* Print  Information table */
echo "<div class='colourbackground'>";
$sql = "SELECT * FROM ElementFurtherInformation WHERE
DATE_FORMAT(PaymentDate,'%d %b %Y')  =  '$pdate'";
$sql_result = mysql_query($sql,$connection) or die("Couldn't execute
query.");
echo "<table class=efitable>";
echo "<caption align =left class=caption><b>Element Further
Information</b></caption>";
echo "<tr><td class=td>Description</td><td class=td>Amount</td></tr>\n";
while ($myrow = mysql_fetch_row($sql_result)) {
        printf("<tr><td>$myrow[0]</td><td>£$myrow[1]</td></tr>\n");
}
echo "</table>\n";
echo "</div>\n";

Standard closing tags etc after...


The table is formatted with a border and a background colour however the div
should also draw a background colour underneath the table so any parts that
are normally white should be the colour specified in my css file but it
just appears to ignore it.

I have checked my CSS and can find no problems there, heres hoping someone
here can help.

Many thanks

Rega
 
R

rf

Rigga said:
Hi,

I have created a page that builds up a table using data from a database and
formats the table using css tags.

CSS rules and properties.
I have checked my CSS and can find no problems there, heres hoping someone
here can help.

I'll bet that is where the problem is. Post the contents of your CSS file.
Better yet, post the URL of the page (not the PHP).
 
D

David Dorward

Rigga said:
I have checked my CSS and can find no problems there

Most likely the problem is in the CSS (although the HTML is relevent). Its
much more likely that people could help if you provided a URI where the
code could be seen in context. (For rendering issues the PHP source is
entirely irrelevant, its the generated HTML and the CSS that count here)
 
R

Rigga

David said:
Most likely the problem is in the CSS (although the HTML is relevent). Its
much more likely that people could help if you provided a URI where the
code could be seen in context. (For rendering issues the PHP source is
entirely irrelevant, its the generated HTML and the CSS that count here)
Ok sorry, the page isnt 'live' yet so unable to provide you with a url,
however the CSS file contains this:

.colorbackground {
font-family: arial, helvetica, sans-serif;
margin: 0px 100px 0px 100px;
background-color: #ffdb43;
}

Ive tried applying other CSS styles I have used in the past that color the
background however it does not appear to take effect, I was wondering if it
is not even possible to have a table over a colored square and have the
table itself have colors in. If this doesnt make sense I will post the
html source

Thanks for your help
 
R

rf

Rigga wrote
Ok sorry, the page isnt 'live' yet so unable to provide you with a url,
however the CSS file contains this:

.colorbackground {
font-family: arial, helvetica, sans-serif;
margin: 0px 100px 0px 100px;

I suspect you mean padding. Margin is "outside" the div, padding is
"inside".
background-color: #ffdb43;
}

It would be handy to see the CSS for the table as well. If you want the
div's background to show through then you might need to specify a
transparent background for the table.
 
R

Rigga

Mark said:
From your original post:


Notice a difference?
Yeah that was a typo when posting the message, the code doesnt contain that.
I will check over the entire code and post back later.

Thanks for all your help so far.

R
 
M

Mark Parnell

Yeah that was a typo when posting the message, the code doesnt contain that.

Yet another reason that cut and paste is not at all helpful - we need a
URL. Make up a quick and dirty test page if you can't put the original
online.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top