Sidebar does not display correctly when using scoped css
See original GitHub issueDescribe 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:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I fixed it. You need to use 3x ` for code blocks.
Best bet would be to open up dev tools and see what’s going on by inspecting the sidebar elements.