我正在使用 Visual Studio Code 编辑器并在 bash 终端中运行“npm run sass”。
当我对 scss 文件进行更改时,终端显示:
=> 更改:C:\Users\kenne\modern_portfolio\scss\main.scss 渲染完成,保存 .css 文件...将 CSS 写入 C:\Users\kenne\modern_portfolio\dist\css\main.css
在我的 main.css 文件中,每次我进行更改时都会添加已编译的 css。
当我在 Chrome、FireFox、Edge 中提供页面时,不会为某些子元素呈现更改。(.tech,.item-lang)
当我检查它显示样式是计算的。
未显示样式更改的元素嵌套在具有类属性“tech-main”的 div 中。我曾尝试将 class 属性和 id 属性与嵌套元素一起使用,这在浏览器中没有区别。
我已经用类单独和嵌套编码。见代码片段。
我使用 ctrl F5 清除缓存。
我尝试编写包含文件 _tech.scss 并在主 scss 中使用 @import "tech"。
我已经关闭了所有文件和终端,并多次重新启动了 VScode。
我删除了父 div 及其内容,然后逐行重新编码,认为我的 html 文件以某种方式损坏。那没有帮助。我删除了父 div 并保留了子元素,没有变化。
我什至尝试重新命名子元素。即 class="tech" 到 class="stuff"。没用。
我不知道还有什么办法可以解决或解决这个问题。
以下是我尝试过的三个编码块。
///////////////////////////////////////////
// Tech Page
.tech-main {
display: grid;
grid-gap: 30px;
grid-template-areas: "tech editor";
grid-template-columns: repeat(2, 1fr);
border: 2px solid $secondary-color;
border-radius: 10px;
padding: 15px;
.tech {
border: 2px $secondary-color;
border-radius: 10px;
}
.item-lang {
text-decoration: none;
}
}
//////////////////////////////////////////
// Tech Page
.tech-main {
display: grid;
grid-gap: 30px;
grid-template-areas: "tech editor";
grid-template-columns: repeat(2, 1fr);
border: 2px solid $secondary-color;
border-radius: 10px;
padding: 15px;
&.tech {
border: 2px $secondary-color;
border-radius: 10px;
}
&.item-lang {
text-decoration: none;
}
}
//////////////////////////////////////////
// Tech Page
.tech-main {
display: grid;
grid-gap: 30px;
grid-template-areas: "tech editor";
grid-template-columns: repeat(2, 1fr);
border: 2px solid $secondary-color;
border-radius: 10px;
padding: 15px;
}
.tech {
border: 2px $secondary-color;
border-radius: 10px;
}
.item-lang {
text-decoration: none;
}
html block:
<div class="tech-main">
<div class="tech">
<h2 class="sm-heading">Languages & Frameworks I am familiar with.</h2>
<ul>
<li class="item-lang">
<img src="img/html5_RZ.png" alt="html5 icon" />
</li>
</ul>
</div>
<div class="editor">
<h2 class="sm-heading">Editors I have used.</h2>
<li class="item-editor">
<img src="img/Atom.png" width="128" height="128" alt="Atom icon" />
</li>
</div>
</div>