You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何我的CSS代码提示1处错误?附对应代码片段

CSS Media Query Syntax Error Fix

Hey Raju, I spotted the issue right away—your media query has a syntax mistake that's triggering the error.

The Root Cause

You forgot to wrap your target selector and its styles inside curly braces {} right after the media condition. In CSS, media queries require that all styles meant to apply under the specified screen condition are enclosed within a pair of braces following the @media rule. Without these braces, the browser can't parse the rule structure correctly, which throws a syntax error.

Corrected Code

Here's the fixed version of your CSS:

@media only screen and (max-width: 991px) {
  .mobile_header.top_nav_mobile .main_menu_nav > li > a { 
    padding: 11px 36px 11px 44px; 
    display: block; 
    font-size: 20px; 
    color: #ffffff; 
    text-transform: none !important; 
    font-weight: 700; 
    letter-spacing: -0.04em; 
  }
}

Quick Explanation

  • Added an opening { immediately after (max-width: 991px) to define the start of the media query block
  • Added a closing } after the selector's styles to properly end the media query block

This will resolve the syntax error and ensure your mobile header styles apply correctly when the screen width is 991px or smaller.

内容的提问来源于stack exchange,提问作者Raju

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:40:16