Can someone please tell me what is wrong with this?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><link rel="stylesheet" type="text/css" href="main.css" />
</head>
<title></title>
<body>

This is <em>white</em> text on a<strong> black</strong> background



</body>
</html>

body {
background; #000000;
color: #FFFFFF;
}

It's gotta be something simple that I'm overlooking. I'm not a COMPLETE noob to CSS but I'm not advanced either. It's not showing up in any browser that I use. I just get a blank white page.

Dani AI

Generated

Quick summary: the symptoms point to a CSS syntax error that prevented the browser from applying the intended background, which left white text on a white page. and caught the punctuation/syntax problem, and correctly noted the title should be inside the head. Below are focused checks and clarifications that go beyond the immediate typo so the same debugging pattern works in other situations.

Useful checklist and quick tests:

  • Confirm the stylesheet actually loads (Network tab in developer tools) and returns 200. If it fails to load, nothing in it will apply.
  • Inspect the page with the Elements/Styles panel to see computed background and color values for the body element, and to find any other rules overriding them.
  • Validate the CSS file for syntax errors (missing braces, stray characters or wrong at-rules can break parsing). A simple validator will point to parse errors.
  • Hard-refresh the page or clear cache after saving changes; cached CSS often hides fixes.
  • Watch for server-side case sensitivity in filenames, BOM/encoding problems, or incorrect MIME types that can prevent the stylesheet from being used.

A few clarifying notes: CSS declarations follow a strict name:value; format — a typo in punctuation can make a declaration invalid. One bad property usually gets ignored, but structural errors (unclosed braces, malformed at-rules) can cause larger portions of the stylesheet to be skipped. The background shorthand is fine when used correctly, and switching to the color-specific background property is also valid; pick the form that best matches the intent and confirm it in the browser tools.

For reference on syntax and property behavior, consult the official MDN documentation for CSS syntax and the background properties: CSS Syntax and background (MDN). Once the stylesheet loads and the syntax is fixed, the page should render as expected.

Recommended Answers

All 4 Replies

background-color; #000000;

facepalm moment

Biiim is correct there. Change to background-color: The browser isn't "understanding" just background: and ignores it and defaults the background color to white and you are making your text white-on-white. If you click and drag the cursor over the page you'd highlight it and then it would be visible because it is there even if you can't see it.

And not that it effects this but put your title tags inside the open and close head tags =0)

background; #000000;

is incorrect. There should not be a semicolon after background but instead a colon.

background; #000000;

is incorrect. There should not be a semicolon after background but instead a colon.

haha damnit

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.