CSS-Stil wird nicht übernommen

Status
Nicht offen für weitere Antworten.

Nabi

Erfahrenes Mitglied
Hi, Frage: Warum ist das Wort "link" in der Tabelle nicht Rot, Alles was im style
steht ist richtig angewendet ausser die Farbe.
Was ist die Lösung?.

HTML:
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
</head>
<body>
<style> body{background-color:#f0f8ff} 
p{font-family:arial; 
font-size:12 pt;
position: absolute;
left:0 px;
top:100 px;
color:red;
}
</style>
<p>
<table border="0" bgcolor="#f0f8ff" bordercolor="#f0f8ff" width="150">
<?php
for($i=0;$i<6;$i+=1)
{
echo"
<tr>
<td bgcolor=\"ffdead\" onmouseover=\"this.style.backgroundColor='#f0f8ff'\"
onmouseout=\"this.style.backgroundColor='#ffdead'\">link</td>
</tr>";
}
?>
</table>
</p>
</body>
</html>
 
Was hat JS mit PHP zu tun?

b.) Im Style sind nur body und p ersichtlich. Link ist aber auch nur dann ein Link, wenn er als solcher gekennzeichner wird - im CSS über

<a href="#">Link</a>

a:link, a:active {
color: red;
}

Wenn Link ein Absatz sein soll, dann musst du das auch reinschreiben

<p>Link</p>

angesteuert.
 
Zuletzt bearbeitet:
<a href="#">Link</a>
Ich weiss , Ich möchte mit diem code jetzt nicht linken sondern nur die farbe testen
Arial ok , Schrift größe ok , Nur die farbe nicht.

Was hat JS mit PHP zu tun?
Ich programmiere in PHP bin aber noch Anfänger , So weit ich weiss kann man mit
reine PHP Code kein Dynamische Buttons erzeugen, Deswegen muss Man etwas
JS dazu verwnden.
 
PHP:
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Test</title>
	<style type="text/css">
body {
	background-color: #f0f8ff;
} 
p {
	font-family: arial;
	font-size: 12pt;
	position: absolute;
	left: 0px;
	top: 100px;
	color: red;
}
	</style>
</head>

<body>
<table width="150">
<?php

	for( $i=0; $i<6; $i++ ) {
		echo '<tr><td style="background-color:#ffdead" onmouseover="this.style.backgroundColor=\'#f0f8ff\'"
onmouseout="this.style.backgroundColor=\'#ffdead\'">link</td></tr>';
	}

?>
</table>
</body>
</html>
Falls du ein Navigationsmenü realisieren möchtest, gibt es aber weit aus bessere Möglichkeiten.
 
Status
Nicht offen für weitere Antworten.
Zurück