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

CSS类选择器样式失效求助:内联样式正常,类样式无效果

类/id选择器CSS样式无效排查求助

我写过大量纯CSS代码,从未遇到过属性来源不明的情况。目前内联CSS可正常生效,但类、id选择器的CSS样式完全无效,DOCTYPE已正确声明,我花费大量时间排查仍无解决办法,恳请帮助。

HTML代码

<div className='insideContainer'>
  <div className='default'>hello</div>
  <div className='default'>hello</div>
  <div className='default'>hello</div>
  <div className='default'>hello</div>
  <div className='default'>hello</div>
  <div className='default'>hello</div>
  <div className='default'>hello</div>
  <div className='default'>hello</div>
  <div className='default'>hello</div>
</div>

CSS代码

.insideContainer {
  width: 300px;
  height: 400px;
  border: 1px solid #888;
  overflow: scroll;
  margin: 0 auto;
}
.default {
  background-color: 'blue';
  width: 200px;
  height: 50px;
  margin: 5px;
  display: 'flex';
  justify-content: 'center';
  align-items: 'center';
  border: 1px solid #888;
}

浏览器显示效果

浏览器显示截图1
浏览器显示截图2

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 14:35:36