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
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
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically