首页 > 解决方案 > CSS Margin not working in React typescript project

问题描述

CSS margin not working in my react typescript project

My code:

const Home: React.FC = () => {
return (
<div style={{ width: "100vw", background: "skyblue" }}>
  <div
    style={{
      background: "red",
      height: "100px",
      width: "100px",
      marginLeft: "100px",
    }}
  ></div>
</div>
);
};

Codesandbox link for this project

标签: cssreactjstypescriptsass

解决方案


Your margin is overridden by margin: 0px !important which is declared in your App.css file


推荐阅读