Topic: Need a simple way to override the existing css of mdb angular components
shivani.mslc pro asked 6 years ago
Is there any simple way of overriding the css of angular components ?
Damian Gemza staff answered 6 years ago
HTML:
<mdb-tabset #staticTabs class="change-class" [buttonClass]="'nav-tabs tabs-3 indigo'" [contentClass]="'card'"> <!--Panel 1--> <mdb-tabheading="Profile"> <divclass="row"> <divclass="col-12"> <br> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil odit magnam minima, soluta doloribus reiciendis molestiae placeat unde eos molestias. Quisquam aperiam, pariatur. Tempora, placeat ratione porro voluptate odit minima.</p> </div> </div> </mdb-tab> <!--Panel 2--> <mdb-tabheading="Follow"> <divclass="row"> <divclass="col-12"> <br> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil odit magnam minima, soluta doloribus reiciendis molestiae placeat unde eos molestias. Quisquam aperiam, pariatur. Tempora, placeat ratione porro voluptate odit minima.</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil odit magnam minima, soluta doloribus reiciendis molestiae placeat unde eos molestias. Quisquam aperiam, pariatur. Tempora, placeat ratione porro voluptate odit minima.</p> </div> </div> </mdb-tab> <!--Panel 3--> <mdb-tabheading="Contact"> <divclass="row"> <divclass="col-12"> <br> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil odit magnam minima, soluta doloribus reiciendis molestiae placeat unde eos molestias. Quisquam aperiam, pariatur. Tempora, placeat ratione porro voluptate odit minima.</p> </div> </div> </mdb-tab> </mdb-tabset>
.change-class { .indigo { background-color: red!important; } }
shivani.mslc pro commented 6 years ago
This worked... Thanks... Can you help with one more thing ?! How to override internal classes like "nav-item,nav-item a" in tabs? The solution you gave works on overall tabs but if I want to work on internal options of tabs...Damian Gemza staff commented 6 years ago
You could use something like this: .nav-tabs.tabs-3 { .nav-item { } .nav-item a {} }shivani.mslc pro commented 6 years ago
Thank you so much for the help...Damian Gemza staff commented 6 years ago
Glad that could help! Closing topic. Best Regards, DamianDamian Gemza staff answered 6 years ago
.btn-flat { background-color: red; }
shivani.mslc pro commented 6 years ago
These components are fine. But to override tabs & pills css, with the approach you, gave doesn't work.Damian Gemza staff commented 6 years ago
So please try to override it in global styles.scss file, and let me know.shivani.mslc pro commented 6 years ago
Had tried that way as well. The only option that worked was to write override the snippet given in _tabs.scss (mdb file) in custom.scss (file provided by mdb to write custom code). But doing so, overrides css across all the modules and components where tabs / pills are used. This is not what I want. I must be able to override it for a particular module or component where I need the custom css for tabs / pills not affecting other modules or componentsClosed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Closed
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No