Why isn’t my body CSS selector applying?

0
0
Asked By MellowCactus47 On

I'm new to CSS and can't figure out why my styles apply when I use the universal selector (*) but stop applying when I target the body element directly. My CSS currently looks like this:

body {
font-family: Helvetica;
font-size: 22px;
color: seashell;
background-color: black;
opacity: 0.9;
text-align: center;
}

All of my HTML content appears to be inside the body element. Is there something wrong with the selector, my HTML structure, or possibly my editor setup?

1 Answer

Answered By CopperLynx29 On

There’s nothing inherently wrong with targeting body. Try reducing the example to a complete HTML file and verify that the stylesheet link is inside the head, for example: . Also make sure the page contains actual content while testing. A full working example makes it much easier to spot a malformed tag, incorrect file path, or CSS rule that comes later and replaces these styles.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.