Make shortcode's Bootstrap CSS override the theme's CSS, how?

I'm writing a simple WordPress plugin that uses some shortcodes to show content on public side of the side. These s

I'm writing a simple WordPress plugin that uses some shortcodes to show content on public side of the side. These shortcodes use some Bootstrap's components like buttons, input groups and popovers but the CSS of the selected theme interferes with Bootstrap CSS and rendering is not optimal... How can use "pure" Bootstrap CSS just for my shortcodes making them independent of the selected WordPress theme?

I read this possible solution but now Bootstrap no longer uses LESS but SASS and I tried to compile .scss file but some components doesn't work, like tooltips, and some CSS is wrong, like font-family.

I'm writing a simple WordPress plugin that uses some shortcodes to show content on public side of the side. These shortcodes use some Bootstrap's components like buttons, input groups and popovers but the CSS of the selected theme interferes with Bootstrap CSS and rendering is not optimal... How can use "pure" Bootstrap CSS just for my shortcodes making them independent of the selected WordPress theme?

I read this possible solution but now Bootstrap no longer uses LESS but SASS and I tried to compile .scss file but some components doesn't work, like tooltips, and some CSS is wrong, like font-family.

Share Improve this question asked Nov 18, 2019 at 17:49 icolumbroicolumbro 791 silver badge9 bronze badges 2
  • The answer is still just as valid. Them switching from less to sass changes nothing in that context, you just need to fix your build pipeline – kero Commented Nov 18, 2019 at 17:56
  • I followed this more recent discussion almost work but tooltips and I can't understand why... How jQuery can be affected by this customization? – icolumbro Commented Nov 18, 2019 at 18:09
Add a comment  | 

1 Answer 1

Reset to default 1

Ok, I think I solved: followed this discussion so I imported Bootstrap SASS file in a new SASS file creating a custom class as container to isolate Bootstrap components and compiled the custom .scss to .css. Fixed html and body selector in new CSS file and to have working tooltips I did:

$('[data-toggle="tooltip"]').tooltip({
  container: '.custom-container', //needed to have working tooltips
  html: true,
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744993315a4605037.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信