首页 > 解决方案 > <styled component> 属性在 gatsby 服务后消失

问题描述

我正在为我的 gatsby 网站使用 < styled components >,除了一个细节外,一切都运行良好:在我“gatsby serve”之后,边框半径不适用于 Img。有任何想法吗?

const Headshot = styled(Img)`
   box-shadow: 0 0.7em 1em 0 rgba(0,0,0,.3);
   margin: 0 auto;
   border-radius:100%;
`

这在检查“gatsby develop”上的 img 时显示:

.gttwKy {
    box-shadow: 0 0.7em 1em 0 rgba(0,0,0,.3);
    margin: 0 auto;
    border-radius: 100%;
}

这在检查“gatsby serve”上的 img 时显示:

.lnclJt {
    box-shadow: rgba(0, 0, 0, 0.3) 0px 0.7em 1em 0px;
    margin: 0px auto;
}

谢谢!

标签: imagegatsbystyled-components

解决方案


推荐阅读