Hi, could someone tell me why this CSS dosent work, or do i need this to be posted in the PHP section? The path is right...
Code for CSS =
body {
font:14px Arial, Helvetica, sans-serif;
}
.details {
display: none;
font-size:12px;
}
.red_title{
font:20pt Arial;
font-weight:normal;
color:#f00;
}
.button {
background-image: url("admin_area/images/plus.gif");
width: 9px;
height: 9px;
display:block;
float: left;
margin-right: 5px;
margin-top: 2px;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Leaders</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link href=http://www.webdeveloper.com/forum/archive/index.php/"CSS/PHP_Display.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function showDetails(memberID,button){
var element = document.getElementById(memberID);
if(element.style.display != 'block'){
element.style.display = 'block';
button.style.backgroundImage = 'url("/images/minus.gif")';
}else{
element.style.display = 'none';
button.style.backgroundImage = 'url("/images/plus.gif")';
}
}
</script>
<noscript>
<style type="text/css">
.details {
display: block;
}
</style>
</noscript>
</head>
<body>
<div class="body_bold">
<?php
$connx = @mysql_connect("--", "--", "--") or
die("ERROR: Unable to establish database connection");
$dbconnx = @mysql_select_db('--') or
die("ERROR: Unable to establish database connection");
?>
<p class="red_title">Leader Team</p>
<blockquote>
<?php
// Request the text of all the jokes
$result = @mysql_query('SELECT * FROM `Contacts` GROUP BY `ID`'); /* YOU MAY NEED TO EDIT THIS ID SO THAT
IT IS THE SAME AS THE FIELD NAME
IN YOUR DATABASE */
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
$num = mysql_num_rows($result);
echo "<div id=\"alldetails\">";
for ($i=0; $i<$num; $i++)
{
$row = mysql_fetch_row($result);
echo "\n<p><input type=\"image\" class=\"button\" id=\"button$i\" value=\" \" onclick=\"showDetails('person$i',this);return true;\"> $row[2] $row[3] <a href=http://www.webdeveloper.com/forum/archive/index.php/\"mailto:$row[9]\">$row[9]</a></p>\n";
echo "<p id=\"person$i\" class=\"details\">
Position: $row[1]<br>\n
Name: $row[2] $row[3]<br>\n
Address: $row[4]<br>\n
Town: $row[5]<br>\n
Postcode: $row[6]<br>\n
Home Phone: $row[7]<br>\n
Mobile: $row[8]<br>\n
Email: $row[9]</p>";
}
echo "</div>";
?>
</blockquote>
</div>
</body>
</html>Please don't post PHP code in this forum. We need to see the HTML that the PHP code outputs. You can view it by viewing the source of that page in your browser.
What do you mean by "this CSS dosent work"? Please be more specific.
It would be great if you could provide a link to the page in question.Well here is the page. <!-- m --><a class="postlink" href="http://scott.loddonexplorers.co.uk/contacts.php">http://scott.loddonexplorers.co.uk/contacts.php</a><!-- m -->
Title should be red, font should be arial etc etcThe path to the CSS file appears to be incorrect.
Please fix your XHTML errors. (<!-- m --><a class="postlink" href="http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fscott.loddonexplorers.co.uk%2Fcontacts.php">http://validator.w3.org/check?verbose=1 ... ntacts.php</a><!-- m -->)Fixed the path, but still, nothing has changed.Upon checking the XHTML errors i came accros this. I dont see why it isnt aloud there though.
Error Line 22 column 22: document type does not allow element "style" here.
<style type="text/css">
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).That error means that noscript elements aren't allowed in <head>. You should put that CSS in your normal stylesheet and use JavaScript to output some CSS that overrides it.
Code for CSS =
body {
font:14px Arial, Helvetica, sans-serif;
}
.details {
display: none;
font-size:12px;
}
.red_title{
font:20pt Arial;
font-weight:normal;
color:#f00;
}
.button {
background-image: url("admin_area/images/plus.gif");
width: 9px;
height: 9px;
display:block;
float: left;
margin-right: 5px;
margin-top: 2px;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Leaders</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link href=http://www.webdeveloper.com/forum/archive/index.php/"CSS/PHP_Display.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function showDetails(memberID,button){
var element = document.getElementById(memberID);
if(element.style.display != 'block'){
element.style.display = 'block';
button.style.backgroundImage = 'url("/images/minus.gif")';
}else{
element.style.display = 'none';
button.style.backgroundImage = 'url("/images/plus.gif")';
}
}
</script>
<noscript>
<style type="text/css">
.details {
display: block;
}
</style>
</noscript>
</head>
<body>
<div class="body_bold">
<?php
$connx = @mysql_connect("--", "--", "--") or
die("ERROR: Unable to establish database connection");
$dbconnx = @mysql_select_db('--') or
die("ERROR: Unable to establish database connection");
?>
<p class="red_title">Leader Team</p>
<blockquote>
<?php
// Request the text of all the jokes
$result = @mysql_query('SELECT * FROM `Contacts` GROUP BY `ID`'); /* YOU MAY NEED TO EDIT THIS ID SO THAT
IT IS THE SAME AS THE FIELD NAME
IN YOUR DATABASE */
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
$num = mysql_num_rows($result);
echo "<div id=\"alldetails\">";
for ($i=0; $i<$num; $i++)
{
$row = mysql_fetch_row($result);
echo "\n<p><input type=\"image\" class=\"button\" id=\"button$i\" value=\" \" onclick=\"showDetails('person$i',this);return true;\"> $row[2] $row[3] <a href=http://www.webdeveloper.com/forum/archive/index.php/\"mailto:$row[9]\">$row[9]</a></p>\n";
echo "<p id=\"person$i\" class=\"details\">
Position: $row[1]<br>\n
Name: $row[2] $row[3]<br>\n
Address: $row[4]<br>\n
Town: $row[5]<br>\n
Postcode: $row[6]<br>\n
Home Phone: $row[7]<br>\n
Mobile: $row[8]<br>\n
Email: $row[9]</p>";
}
echo "</div>";
?>
</blockquote>
</div>
</body>
</html>Please don't post PHP code in this forum. We need to see the HTML that the PHP code outputs. You can view it by viewing the source of that page in your browser.
What do you mean by "this CSS dosent work"? Please be more specific.
It would be great if you could provide a link to the page in question.Well here is the page. <!-- m --><a class="postlink" href="http://scott.loddonexplorers.co.uk/contacts.php">http://scott.loddonexplorers.co.uk/contacts.php</a><!-- m -->
Title should be red, font should be arial etc etcThe path to the CSS file appears to be incorrect.
Please fix your XHTML errors. (<!-- m --><a class="postlink" href="http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fscott.loddonexplorers.co.uk%2Fcontacts.php">http://validator.w3.org/check?verbose=1 ... ntacts.php</a><!-- m -->)Fixed the path, but still, nothing has changed.Upon checking the XHTML errors i came accros this. I dont see why it isnt aloud there though.
Error Line 22 column 22: document type does not allow element "style" here.
<style type="text/css">
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).That error means that noscript elements aren't allowed in <head>. You should put that CSS in your normal stylesheet and use JavaScript to output some CSS that overrides it.