【问题标题】:How to set default styles in unordered lists in Material-UI React如何在 Material-UI React 的无序列表中设置默认样式
【发布时间】:2022-01-02 21:31:58
【问题描述】:

我正在尝试复制 a simple blog from markdown with Next.js and Material-UI,但有些东西正在从无序列表中删除默认样式。

列表项(li HTML 元素)设置了 list-style: none; 并且没有填充。有序列表看起来很正常并且具有默认样式。

它在文档示例中的外观:

当我使用相同的内容和降价处理代码时我得到了什么:

无论我直接在 JSX 中使用 markdown 内容还是 ul/ol/li 元素,问题仍然存在。

In the documentation example, the code that reads markdown and transforms it 进入 React 组件似乎也没有改变样式。

【问题讨论】:

    标签: css reactjs material-ui markdown html-lists


    【解决方案1】:

    我的错,我在一个组件中有以下代码片段:

    <GlobalStyles styles={{ ul: { margin: 0, padding: 0, listStyle: 'none' } }} />
    

    这覆盖了默认样式。

    它在一个我不再需要的旧组件中。

    事实证明,鲁莽地覆盖全局样式会让人头疼。

    【讨论】:

      猜你喜欢
      • 2022-10-13
      • 2021-02-05
      • 1970-01-01
      • 2019-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-19
      • 2018-05-04
      相关资源
      最近更新 更多