首页 > 解决方案 > 样式化组件和模板文字

问题描述

有人可以帮助解释这是如何styled.a`aasdasd` 工作的吗?这是有效的 JS 吗?这是什么意思?这是 styled-components图书馆的代码片段?


const Button = styled.a`
  /* This renders the buttons above... Edit me! */
  display: inline-block;
  border-radius: 3px;
  padding: 0.5rem 0;
  margin: 0.5rem 1rem;
  width: 11rem;
  background: transparent;
  color: white;
  border: 2px solid white;

  /* The GitHub button is a primary button
   * edit this to target it specifically! */
  ${props => props.primary && css`
    background: white;
    color: black;
  `}
`

标签: javascriptcssstyled-components

解决方案



推荐阅读