Media Querys serve to determine a style for a particular situation (eg example, specific screen size, orientation, etc.)
For screen sizes, you usually use these breakpoints:
/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {...}
/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {...}
/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {...}
/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {...}
/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {...}
Materialize uses breakpoints, see the Creating Responsive Layouts section
An example usage:
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.carousel');
var instances = M.Carousel.init(elems, {});
});
img {
height: 100%;
}
/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
.carousel-item {
height: 100px !important;
}
}
/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {
.carousel-item {
height: 200px !important;
}
}
/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {
.carousel-item {
height: 300px !important;
}
}
/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {
.carousel-item {
height: 400px !important;
}
}
/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
.carousel-item {
height: 500px !important;
}
}
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<div class="carousel">
<a class="carousel-item" href="#one!"><img src="https://lorempixel.com/250/250/nature/1"></a><aclass="carousel-item" href="#two!"><img src="https://lorempixel.com/250/250/nature/2"></a><aclass="carousel-item" href="#three!"><img src="https://lorempixel.com/250/250/nature/3"></a><aclass="carousel-item" href="#four!"><img src="https://lorempixel.com/250/250/nature/4"></a><aclass="carousel-item" href="#five!"><img src="https://lorempixel.com/250/250/nature/5"></a></div><!--CompiledandminifiedJavaScript--><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>