Hallo,

Ik heb een vraag over media query's.

moet ik aparte mediaquery's schrijven voor mobiele apparaten, zowel staand als liggend of negeer het.
voorbeeld :

@media  screen and (min-device-width: 320px) and (max-device-height: 568px) and (orientation : portrait)
 
 {



zou dat verschil maken in de praktijk als ik negeer portriat of landscape?
bedankt
johannes
In media-queries is de oriëntation niet verplicht.
min-device-width moet je niet gebruiken. Gebruik in plaats daarvan min-width. Zelfde voor de hoogte.
Ik heb ooit dit als voorbeeld gekregen. Plak het in een test.html en zie je de effecten als je je browser op je laptop of desktop verkleint. Van telefoon tot groot scherm. Makkelijk een css van te maken

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>

.example {
  padding: 20px;
  color: white;
}


 /* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {

body {
    background-color: lightblue;
  }

}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {

body {
    background-color: blue;
  }

}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {

body {
    background-color: red;
  }

}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {

body {
    background-color: green;
  }

}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {

body {
    background-color: yellow;
  }


</style>
</head>

<body>

<h2>Typical Media Query Breakpoints</h2>
<p class="example">Resize the browser window to see how the background color of this paragraph changes on different screen sizes.</p>


</body>
</html>


Reageren