You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please refer to the various [pseudo-classes](/en-US/docs/Web/CSS/Pseudo-classes) of `@page` for examples.
366
+
See the various [pseudo-classes](/en-US/docs/Web/CSS/Pseudo-classes) of `@page` for examples.
391
367
392
368
- {{Cssxref(":blank")}}
393
369
- {{Cssxref(":first")}}
@@ -404,8 +380,8 @@ Please refer to the various [pseudo-classes](/en-US/docs/Web/CSS/Pseudo-classes)
404
380
405
381
## See also
406
382
383
+
- The {{cssxref("page")}} property
407
384
- The `@page`[`size`](/en-US/docs/Web/CSS/@page/size) descriptor
408
-
- The {{Cssxref("page")}} property
409
-
- See the [\[META\] CSS Paged Media Module Level 3](https://bugzil.la/286443) ticket in Bugzilla for tracking progress on the subject (page-based counters, etc.)
Copy file name to clipboardExpand all lines: files/en-us/web/css/@page/page-orientation/index.md
+62-88Lines changed: 62 additions & 88 deletions
Original file line number
Diff line number
Diff line change
@@ -54,8 +54,64 @@ This descriptor helps with the layout and orientation of printed documents, espe
54
54
### Rotating printed pages
55
55
56
56
This example shows how the contents of a print document can be rotated to suit the page content and the page position.
57
+
In this first part of the CSS code, [named pages](/en-US/docs/Web/CSS/@page#named_pages) are set up to define the direction in which to rotate the content.
58
+
59
+
```css live-sample___rotating-pages
60
+
@page upright {
61
+
size: portrait;
62
+
page-orientation: upright;
63
+
}
64
+
65
+
@page left {
66
+
size: landscape;
67
+
page-orientation: rotate-left;
68
+
}
69
+
70
+
@page right {
71
+
size: landscape;
72
+
page-orientation: rotate-right;
73
+
}
74
+
```
75
+
76
+
```css hidden live-sample___rotating-pages
77
+
fieldset {
78
+
display: flex;
79
+
flex-direction: row;
80
+
justify-content: space-between;
81
+
gap: 1rem;
82
+
width: fit-content;
83
+
}
84
+
p {
85
+
max-width: 60ch;
86
+
}
87
+
@mediaprint {
88
+
fieldset {
89
+
display: none;
90
+
}
91
+
section {
92
+
font-family: Roboto, sans-serif;
93
+
font-size: 1.5rem;
94
+
}
95
+
}
96
+
```
97
+
98
+
The second part of the CSS code declares a named page rule defined above for the selectors, such as `<section class="left">…</section>`.
57
99
58
-
```html hidden
100
+
```css live-sample___rotating-pages
101
+
@mediaprint {
102
+
.upright {
103
+
page: upright;
104
+
}
105
+
.left {
106
+
page: left;
107
+
}
108
+
.right {
109
+
page: right;
110
+
}
111
+
}
112
+
```
113
+
114
+
```html hidden live-sample___rotating-pages
59
115
<fieldsetid="printStyle">
60
116
<legend>
61
117
Click Print. The page will be laid out in the defined orientation.
@@ -72,29 +128,8 @@ This example shows how the contents of a print document can be rotated to suit t
72
128
page-orientation: upright;
73
129
}
74
130
</pre>
75
-
<p>
76
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur eu
77
-
convallis ligula, tincidunt malesuada tortor. Ut ac turpis erat. Mauris
78
-
consequat, leo rhoncus venenatis elementum, sem nisl venenatis justo, non
79
-
mattis diam massa vitae dolor. Aenean ac dolor et leo laoreet tincidunt.
80
-
Suspendisse tempus risus nibh, a feugiat mauris pharetra a. Nulla mi dui,
81
-
scelerisque vitae sollicitudin nec, placerat eget purus. Vivamus enim
82
-
elit, scelerisque id venenatis eu, sodales vel leo. Quisque bibendum
83
-
feugiat diam, ut feugiat urna suscipit et. Nulla lacinia metus a nisi
84
-
volutpat interdum. Lorem ipsum dolor sit amet, consectetur adipiscing
85
-
elit. Vestibulum vitae elit vel orci malesuada bibendum ut vitae enim. Ut
86
-
ultrices elit nec vestibulum blandit. In eleifend dui. Nam nec aliquet
87
-
nunc. Praesent convallis ipsum sed fermentum scelerisque.
88
-
</p>
89
-
<p>
90
-
Praesent posuere, neque non fringilla ultricies, purus mi ullamcorper
91
-
velit, vitae egestas nisl eros at ex. Nulla sed viverra libero. Praesent
92
-
sed placerat magna, iaculis commodo lectus. Ut gravida ligula sed purus
93
-
molestie, in accumsan est eleifend. Etiam consectetur nulla pretium
94
-
blandit iaculis. Nunc semper libero ut mauris faucibus placerat. Cras ac
95
-
justo ac est laoreet sollicitudin. Aliquam vel sapien ut sapien vestibulum
96
-
dictum.
97
-
</p>
131
+
<p>Paragraph one.</p>
132
+
<p>Paragraph two.</p>
98
133
</section>
99
134
<sectionclass="left">
100
135
<h2>Section in Landscape/Left</h2>
@@ -291,77 +326,16 @@ This example shows how the contents of a print document can be rotated to suit t
291
326
</div>
292
327
```
293
328
294
-
#### CSS
295
-
296
-
In this first part of the CSS code, [named pages](/en-US/docs/Web/CSS/@page#named_pages) are set up to define the direction in which to rotate the content.
297
-
298
-
```css
299
-
@page upright {
300
-
size: portrait;
301
-
page-orientation: upright;
302
-
}
303
-
304
-
@page left {
305
-
size: landscape;
306
-
page-orientation: rotate-left;
307
-
}
308
-
309
-
@page right {
310
-
size: landscape;
311
-
page-orientation: rotate-right;
312
-
}
313
-
```
314
-
315
-
```css hidden
316
-
fieldset {
317
-
display: flex;
318
-
flex-direction: row;
319
-
justify-content: space-between;
320
-
gap: 1rem;
321
-
width: fit-content;
322
-
}
323
-
p {
324
-
max-width: 60ch;
325
-
}
326
-
@mediaprint {
327
-
fieldset {
328
-
display: none;
329
-
}
330
-
section {
331
-
font-family: Roboto;
332
-
font-size: 1.5rem;
333
-
}
334
-
}
335
-
```
336
-
337
-
The following second part of the CSS code declares a named page rule defined above for the selectors, such as `<section class="left">…</section>`.
Copy file name to clipboardExpand all lines: files/en-us/web/css/_colon_first/index.md
+11-15Lines changed: 11 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -30,40 +30,36 @@ The **`:first`** [CSS](/en-US/docs/Web/CSS) [pseudo-class](/en-US/docs/Web/CSS/P
30
30
31
31
## Examples
32
32
33
-
### HTML
33
+
### Using `:first` for page print styles
34
34
35
-
```html
35
+
Press the "Print!" button to print the example. The words on the first page should be somewhere around the center, while other pages will have their contents at the default position:
Press the "Print!" button to print the example. The words on the first page should be somewhere around the center, while other pages will have their contents at the default position.
0 commit comments