Hi....I am using a refering code..to fetch & run a stylesheet.css...it working fine in mozilla,opera,IE8...but it's not working in googlechrome & safari.....plzz someone solve this out...

refering code

<?php
......
print "<link rel='stylesheet' href='stylesheet.css' type='text/css'>";
......

?>

stylesheet

body {

a:link, a:visited, a:active { text-decoration: none}

font-family:Verdana, Sans-serif;

color; #000000;

font-size: 12px

}

input,textarea, select,{

	color : #000000;

	font: normal 12px;

	border-collapse: collapse; border: 1px solid #000000;

}

.maintable {border: 0px ; width: 100%; padding: 0px; background-color: #FFFFFF} /*main table for forum*/

.regrow {font-family: Verdana,Sans-serif; color: #000000; font-weight: bold; background-color: #FFFFFF;font-size: 12px;} /*registration row, mainly here for symetry*/

.headline {font-family: Verdana,Sans-serif;font-weight: bold;color: #FFFFFF;background-color: #E9013C;font-size: 11px;} /*headline row, the first row that says forum name, topics, posts and such*/

.forumrow {font-family: Verdana,Sans-serif; color: #000000;background-color: #EAE7E3;font-size: 12px;} /*color of the forum rows*/

.mainrow a:link, a:visited,  a:active { text-decoration: none;}

.mainrow {font-family: Verdana,Sans-serif; color: #000000;background-color: #EAE7E3;font-size: 12px; a:link, a:visited, a:active { text-decoration: none}} /*color of the forum rows*/

.maintables{background-color: #FFFFFF; width: 95%; padding: 0px; border: 1px solid; cellspacing: no} /*main table for forum*/

Dani AI

Generated

A concise add-on for future readers: the mismatch you saw (works in Firefox, fails in Chrome/Safari) almost always comes from broken CSS syntax or illegally nested rules. As pointed out, browsers expect each selector block at top level — you cannot put one rule block inside another in standard CSS. Firefox is forgiving and may continue after an error; WebKit (Chrome/Safari) is stricter and will often stop applying rules after it hits a parse error, so later styles never take effect.

Items to check (from the posted stylesheet) without reproducing code here:

  • Look for accidentally nested blocks, stray commas or trailing punctuation after selector lists, and swapped colons/semicolons — any of these can break parsing.
  • Ensure you aren’t using HTML-only attributes or invalid property names inside CSS (those belong on the element or need the correct CSS property).
  • Verify selectors and declarations are closed properly with braces and semicolons.

Practical debugging steps:

  • Use DevTools (Elements/Styles and the Console) in Chrome to see parsing warnings and to confirm the stylesheet is loading (Network tab).
  • Run the CSS through the W3C validator to get exact error line numbers.
  • Isolate the problem by loading a minimal stylesheet and re-adding blocks until the failure reappears.
  • Confirm the link tag is produced correctly and the server serves the file as CSS (text/css); PHP output itself is rarely the culprit but malformed output or stray bytes can matter.

A small clarification for : the CSS spec allows both 0 and 0px; using plain 0 is common but 0px is valid too. For more on CSS syntax and parsing, see the MDN syntax guide and length units, Chrome DevTools docs, and the W3C validator:
MDN: CSS Syntax
MDN: length
Chrome DevTools
W3C CSS Validator

Recommended Answers

All 5 Replies

What exactly isn't working in safari/chrome (specifically what part of the CSS isn't working)? The PHP has nothing to do with it I can tell you that.

I am giving 2 diff screenshots of the same page for mozilla and safari..now u can easily understand..what is the prob...

In Mozilla


In Safari

a:link, a:visited, a:active { text-decoration: none} Should be outside of the body{} block. Move it, that should fix it.

Same goes for .mainrow near the bottom. You can't nest CSS selectors like that.

thanks..........it worksssssssss

0px is an invalid style. It should be just 0, with no unit of measure, for a 0 value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.