CSS中box-shadow与margin属性无效,浏览器提示无效属性值求助
box-shadow and margin on .card-grey Divs Hey there! Let's get your card styles working properly. The root cause of your "Invalid property value" error is actually a tiny typo in your CSS selector that's making the entire rule unrecognizable to the browser.
The Problem: Invalid CSS Selector
Take a look at your .card-grey rule in the CSS:
**.card-grey { background-color : #36393F; margin:30px; box-shadow: 5px 5px 10px yellow;** }
You’ve added extra ** at the start and end of the selector block. These asterisks aren’t valid syntax for a CSS class selector—they break the entire rule, so the browser ignores all the properties inside (including margin and box-shadow).
The Fix
Just remove those extra asterisks, and your CSS rule will work as expected. Here’s the corrected version:
.card-grey { background-color: #36393F; margin: 30px; box-shadow: 5px 5px 10px yellow; }
Bonus: Minor HTML Fix
While it’s not causing your current style issue, you have an unclosed <meta> tag in your HTML head. This can lead to unexpected rendering quirks later, so fix it by adding a closing />:
<meta name="Description" content="Bienvenue sur le profil de x, alias x" />
Once you make these changes, refresh your browser, and you’ll see the margin spacing between cards and the yellow box-shadow appear as intended.
内容的提问来源于stack exchange,提问作者Philippe

