custom className semantic ui react

后端 未结 3 429
渐次进展
渐次进展 2021-01-21 05:22

I was hoping to do something like this:


But no matter if I add a class name this is all that s

相关标签:
3条回答
  • 2021-01-21 05:32

    That's very odd, when i strip out everything in the file and try something similar to your codesandbox it works. I will play around with my code and post what the issue is once I figure it out

    0 讨论(0)
  • 2021-01-21 05:35

    as Tholle mentioned, it should work. see working example: https://codesandbox.io/s/2p398kyykr

    0 讨论(0)
  • 2021-01-21 05:50

    I had similar issue of using the className . The class was getting applied when I viewed the source but the margin for which the class was added wasn't applied.

    Later, I figured that the default classes such as ui, divider of semantic-ui have their own margin added.

    Solution:

    Add !important for the css property which is getting overwritten by sematic-ui css classes.

    e.g: divider.jsx

    import React from 'react';
    import { Divider } from 'semantic-ui-react';
    import './styles.css';
    const CustomDivider = () => <Divider className='custom-margin-class'/>;
    export default CustomDivider;
    

    styles.css

    .custom-margin-class {
        margin: 8px !important;
    }
    
    0 讨论(0)
提交回复
热议问题