/    Sign up×
Community /Pin to ProfileBookmark

Styles wont work

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 =

[CODE]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;
}[/CODE]

[code=php]
<!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=”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=”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>
[/code]

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@KravvitzFeb 13.2006 — 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.
Copy linkTweet thisAlerts:
@scottyrobauthorFeb 13.2006 — Well here is the page. http://scott.loddonexplorers.co.uk/contacts.php

Title should be red, font should be arial etc etc
Copy linkTweet thisAlerts:
@KravvitzFeb 13.2006 — The path to the CSS file appears to be incorrect.

[url=http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fscott.loddonexplorers.co.uk%2Fcontacts.php]Please fix your XHTML errors.[/url]
Copy linkTweet thisAlerts:
@scottyrobauthorFeb 13.2006 — Fixed the path, but still, nothing has changed.
Copy linkTweet thisAlerts:
@scottyrobauthorFeb 13.2006 — 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).
Copy linkTweet thisAlerts:
@KravvitzFeb 13.2006 — 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.
×

Success!

Help @scottyrob spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...