im new to SCSS and im trying to maintain good quality of cover image of my site. Anyways, the css is working good, meanwhile the scss is not.
SCSS
#page-login-index {
@media screen and (min-aspect-ratio: 5/4) {
background-color: red;
}}
CSS
@media screen and (min-aspect-ratio: 5/4) {
#page-login-index {
background-color: red;
}}
I need to do that in SCSS, since im loading some things from PHP. I've noticed that aspect-ratio and device-aspect-ratio is not working while min-height is working fine.
4.6. The ' aspect-ratio ' media feature is defined as the ratio of the value of the ' width ' media feature to the value of the ' height ' media feature.
Setting a particular "width-range" isn't any different from the way media queries are created. The only difference is the addition of more media feature expressions (that is, the screen width sizes). Take a look: @media only screen and (min-width: 360px) and (max-width: 768px) { // do something in this width range. }
Media Query Not Working on Mobile Devices If media queries work on desktop and not on mobile devices, then you most likely haven't set the viewport and default zoom. Note: You only need to add one of the code lines above, and usually, the first one does the job.
If you want to include both min and max width for responsiveness in the browser, then you can use the following: @media (min-width: 768px) and (max-width: 992px){...} @media (min-width: 480px) and (max-width: 767px) {...}
I figured it out.
when i wrote
@media (min-aspect-ratio: 5/4) {
background-image: url('someurl');
}
scss compiled it to (min-aspect-ratio: 1.25) which was wrong
i had to put it as a string into variable like: $aspect54 : "(min-aspect-ratio: 5/4)";
so in the end it looked like this
$aspect54 : "(min-aspect-ratio: 5/4)";
@media #{$aspect54} {
background-image: url('someurl');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With