question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sidebar does not display correctly when using scoped css

See original GitHub issue

Describe the bug

I need to use scoped css to avoid the bootstrap vue css ‘polluting’ the rest of the page. This is achieved using v-deep to ensure the styling is scoped correctly.

However this means that I cannot use a sidebar, as it does not render correctly. Removing scoping and it displays as expected.

Steps to reproduce the bug

Add bootstrap vue styling as follows: -

<style lang="scss" scoped>
::v-deep {
    @import '~bootstrap/scss/bootstrap.scss';

    /* Default body styles */
    margin: 0;
    font-family: $font-family-base;
    @include font-size($font-size-base);
    font-weight: $font-weight-base;
    line-height: $line-height-base;
    color: $body-color;
    text-align: left;
    background-color: $body-bg;

    @import '~bootstrap-vue/dist/bootstrap-vue.css';
}
</style>

And add a sidebar and it renders incorrectly.

Remove the scoping (incuding the v-deep): -

<style lang="scss">
    @import '~bootstrap/scss/bootstrap.scss';
    @import '~bootstrap-vue/dist/bootstrap-vue.css';
</style>

and the sidebar displays as expected.

Versions

Libraries:

  • BootstrapVue: 2.15.0
  • Vue: 2.6.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Hiwscommented, Jul 14, 2020

I fixed it. You need to use 3x ` for code blocks.

0reactions
Hiwscommented, Jul 14, 2020

Best bet would be to open up dev tools and see what’s going on by inspecting the sidebar elements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS <style scoped> applies outside of the scope
When the migration is complete, you will access your Teams at stackoverflowteams.com, and they will no longer appear in the left sidebar on...
Read more >
A Dynamically-Sized Sticky Sidebar with HTML and CSS
I recently worked on a desktop layout that we're all familiar with: a main content area with a sidebar next to it. This...
Read more >
CSS Scoping Module Level 1 - W3C
Abstract. This specification defines various scoping/encapsulation mechanisms for CSS, including scoped styles and the @scope rule, ...
Read more >
Scoped CSS - Vue Loader
Scoped CSS. When a <style> tag has the scoped attribute, its CSS will apply to elements of the current component only. This is...
Read more >
Blazor CSS Isolation bundle is not deployed to local iOS device
When the app launches, the template's sidebar and hamburger menu (which should be at the top of the page) are not visible.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found