aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/css/@media/orientation/index.html
blob: 53208a4b340ab4e55172515801f3d608942546e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
title: orientation
slug: Web/CSS/@media/orientation
tags:
  - CSS
  - Caractéristique média
  - Reference
translation_of: Web/CSS/@media/orientation
---
<div>{{CSSRef}}</div>

<p><strong><code>orientation</code></strong> est une caractéristique média CSS (cf. {{cssxref("@media")}}) qui peut être utilisée pour vérifier l'orientation de la zone d'affichage (<em>viewport</em>) (ou la boîte de la page pour les média paginés).</p>

<h2 id="Syntaxe">Syntaxe</h2>

<p>La caractéristique <code>orientation</code> se définit grâce à l'un des mots-clés suivants :</p>

<dl>
 <dt><code>portrait</code></dt>
 <dd>La zone d'affichage est en mode portrait (la hauteur est la plus grande dimension).</dd>
 <dt><code>landscape</code></dt>
 <dd>La zone d'affichage est en mode paysage (la largeur est la plus grande dimension).</dd>
</dl>

<h2 id="Exemples">Exemples</h2>

<h3 id="HTML">HTML</h3>

<pre class="brush: html">&lt;div&gt;Boîte 1&lt;/div&gt;
&lt;div&gt;Boîte 2&lt;/div&gt;
&lt;div&gt;Boîte 3&lt;/div&gt;
</pre>

<h3 id="CSS">CSS</h3>

<pre class="brush: css">body {
  display: flex;
}

div {
  background: yellow;
}

@media (orientation: landscape) {
  body {
    flex-direction: row;
  }
}

@media (orientation: portrait) {
  body {
    flex-direction: column;
  }
}</pre>

<h3 id="Résultat">Résultat</h3>

<p>{{EmbedLiveSample("Exemples")}}</p>

<h2 id="Spécifications">Spécifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Spécification</th>
   <th scope="col">État</th>
   <th scope="col">Commentaires</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS4 Media Queries', '#orientation', 'orientation')}}</td>
   <td>{{Spec2('CSS4 Media Queries')}}</td>
   <td>Aucune modification.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS3 Media Queries', '#orientation', 'orientation')}}</td>
   <td>{{Spec2('CSS3 Media Queries')}}</td>
   <td>Définition initiale.</td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>

<p>{{Compat("css.at-rules.media.orientation")}}</p>