I have only two tabs in lightning-tabset. And its align left. I need to have it in center. I tried padding-left: 200px; on ".slds-tabs" but nothing seems to be working. It works when i change through inspect element. But Nothings happening when i add code in componet's .css file.
here is playground's link : https://developer.salesforce.com/docs/component-library/tools/playground/BZGvQu4nV/8/edit
Is there any cleaner approach without using padding?
I know its very basic and silly question.
Any help would be appreciated.
Thanks,
Manohar
Best Answer
Personally, I try to avoid lwc components as soon as custom css is involved because of restrictions imposed by shadow dom
This gist leverages the slds tabs blueprint
I simply declared the .tab-container as flex, aligned the items to center, and each li item is also self centered.
example.html
(sample method to toggle css classes for activating tabs - you can easily achieve the same for the content tabs)
example.js
example.css
Preview: