[英]Problem styling create-react-app with SCSS
I am trying to implement SASS styling on a component.我正在尝试在组件上实现 SASS 样式。 Here is the
Component.js
file:这是
Component.js
文件:
import React from "react";
import "../../assets/scss/_callme.scss"
function Component() {
return (
<div>
<a href="#" className="phoneMe" >
</a>
</div>
);
}
export default Component;
And here is the _callme.scss
file:这是
_callme.scss
文件:
.Component {
.phoneme {
position: "fixed";
display: "flex";
border-radius: 30;
padding: 0;
margin: 20;
align-items: "center";
justify-content: "center";
right: 0;
bottom: 0;
height: 50;
width: 50;
background: "green";
color: "white";
}
}
I think there is a synthax error somewhere, but I couldn't find.我认为某处存在合成错误,但我找不到。 Or maybe the problem is at importing or naming the file.
或者问题可能在于导入或命名文件。 Can you help?
你能帮我吗?
I think your problems are the following我认为您的问题如下
First match the selector by adding class "component", prefer lowercase class names.首先通过添加 class “组件”来匹配选择器,首选小写 class 名称。
function Component() {
return (
<div className="component">
<a href="#" className="phoneme" >
</a>
</div>
);
}
and second remove "" for property values in css第二次删除 css 中属性值的“”
.component {
.phoneme {
position: fixed;
display: flex;
border-radius: 30;
padding: 0;
margin: 20;
align-items: center;
justify-content: center;
right: 0;
bottom: 0;
height: 50;
width: 50;
background: green;
color: white;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.