我已經撰寫了這么多純 CSS 代碼行,而且我從來沒有遇到過不知道屬性來自哪里的情況。行內 CSS 有效,但類/id 無效。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;
}
瀏覽器:


uj5u.com熱心網友回復:
我相信你不必要地用引號包裹你的風格。
background-color: 'blue';
只需將其更改為:
background-color: blue;
uj5u.com熱心網友回復:
className 應該是 class 并洗掉 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;
}
<div className='insideContainer'>
<div class='default'>hello</div>
<div class='default'>hello</div>
<div class='default'>hello</div>
<div class='default'>hello</div>
<div class='default'>hello</div>
<div class='default'>hello</div>
<div class='default'>hello</div>
<div class='default'>hello</div>
<div class='default'>hello</div>
</div>
uj5u.com熱心網友回復:
正如@kind 用戶指出的那樣,由于我復制粘貼了行內 CSS,因此我忘記了更改background-color: 'blue'tobackground-color: blue以及其他一些屬性。謝謝!
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/520555.html
標籤:htmlcss反应
