@media does not work in .vue file's style area
See original GitHub issueVersion
2.6.10
Reproduction link
https://jsfiddle.net/chrisvfritz/50wL7mdz/
Steps to reproduce
Create a new component in .vue file
<template>
<header class="header"></header>
</template>
<script>
export default {
}
</script>
<style scoped>
.header {
height: 2000px;
background-color: black;
}
@media only screen and (min-width: 576px) {
.header {
height: 2000px;
background-color: white;
}
}
</style>
What is expected?
Media query detects different resolutions and apply styling
What is actually happening?
Media query does not work and the styling with line priority applies.
If I don’t use VueJS it works just fine. I tried with raw html css it is fine.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Media query does not work in VueJS style tag - Stack Overflow
Problem solved. It is not related with vue.js or anything. It is because of a missing meta tag in index.html file.
Read more >Media queries won't work without !important - Vue Forum
Try inspecting the relevant element in the browser developer tools to see what CSS rules are being applied and what selectors are used....
Read more >Styling Vue components with CSS - Learn web development
Our work is done on the styling of our sample app. In the next article we'll ... Global styles in Single File Components...
Read more >How To Implement Responsive Design in Vue.js with vue-mq
The trick is to use a breakpoint name as a computed class on the element you want to style. Here is an example...
Read more >Styling a Vue.js application using CSS - LogRocket Blog
To do so efficiently, we will use global styling, rather than styling them in a scoped or external file (although this would work...
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 Free
Top 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
Problem solved. There was a missing meta tag on index.html
If you can share your codebase maybe I can help, but better to take this on to Discord; https://discordapp.com/invite/HBherRA