| | |
| | | <section> |
| | | <iframe data-src="/assets/html/css-grid-example-4.html"></iframe> |
| | | </section> |
| | | <section> |
| | | <h3>Media Queries</h3> |
| | | <ul> |
| | | <li>"Medienabfragen"</li> |
| | | <li>Styles auf Basis von Eigenschaften des Ausgabemediums</li> |
| | | <li>Große Bildschirme, kleine Bildschirme, Printmedien...</li> |
| | | <li>Hinweis: Sollten immer als letztes (unten) in einem Stylesheet sein</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Syntax</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | @media screen and (min-width: 640px) and (max-width: 1024px) { |
| | | .navigation { |
| | | display: none; |
| | | } |
| | | } |
| | | </code> |
| | | </pre> |
| | | <p>Bedeutung: Wenn die Seite auf einem Display angezeigt wird, welches zwischen 640px und 1024px in der Breite anzeigen kann, dann blende die Navigation aus</p> |
| | | </section> |
| | | <section> |
| | | <h3>Werte für die Ausgabemedien (optional, Standard ist "all")</h3> |
| | | <ul> |
| | | <li>all</li> |
| | | <li>screen</li> |
| | | <li>print</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Werte für die Eigenschaften mit Typ und Erklärung (kleiner Auszug)</h3> |
| | | <ul> |
| | | <li>width (Number, Breite)</li> |
| | | <li>height (Number, Höhe)</li> |
| | | <li>orientation (portrait | landscape, Quer- oder Hochformat)</li> |
| | | <li>hover (none | hover, Hat Zeiger zum Hovern)</li> |
| | | <li>forced-colors (none | active, erzwungene Farbpalette z.B. bei Sehbehinderung)</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Aufgabe</h3> |
| | | <p>Entwerfe eine kleine Seite mit @media und zeige ein beliebiges Element ab einer bestimmten Höhe oder Breite an (die Größe des Displays kann dynamisch mit den Entwicklertools im Gerätesimulator geändert werden)</p> |
| | | </section> |
| | | <section> |
| | | <h3>Aufgabe</h3> |
| | | <p>Passe die Vorlage "media-queries-responsive-layout.html" mit @media-Queries so an, dass das Menü links ab einer maximalen Breite von 480 Pixel und kleiner nach links oben in die Ecke minimiert wird und nur per Hover wieder 50% Breite und 100% Höhe bekommt</p> |
| | | </section> |
| | | <section> |
| | | <img data-src="/assets/images/media-queries-excercise.png"> |
| | | </section> |
| | | <section> |
| | | <h3>Lösung</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | @media screen and (max-width: 480px) { |
| | | .menu { |
| | | grid-area: unset; |
| | | |
| | | position: absolute; |
| | | } |
| | | |
| | | .menu:hover { |
| | | height: 100%; |
| | | width: 50%; |
| | | } |
| | | |
| | | .grid { |
| | | grid-template-columns: 0fr 5fr; |
| | | } |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Transform</h3> |
| | | <ul> |
| | | <li>rein optisch, d.h. "physische" Größe bleibt erhalten</li> |
| | | <li>eine Art "Shader" auf Grafikebene</li> |
| | | <li>Effekte wie Drehung, Vergrößerung, Verschiebung usw.</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Syntax</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | .foo { |
| | | transform: translateX(20px) translateY(20px); |
| | | transform-origin: left; |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Mögliche Effekte</h3> |
| | | <ul> |
| | | <li>translate</li> |
| | | <li>rotate</li> |
| | | <li>scale</li> |
| | | <li>scew</li> |
| | | </ul> |
| | | <p>Die meisten besitzen zusätzlich spezifischere X-, Y- oder 3D-Versionen</p> |
| | | </section> |
| | | <section> |
| | | <h3>Aufgabe</h3> |
| | | <p>Probiere die genannten Transform-Effekte in einer beliebigen Seite aus</p> |
| | | </section> |
| | | <section> |
| | | <h3>Transition</h3> |
| | | <ul> |
| | | <li>Elemente können "weich" verändert werden</li> |
| | | <li>Mögliche Attribute, deren Änderungen animiert werden können sind z.B. <code>width</code>, <code>height</code>, <code>transform</code>, <code>color</code> und viele weitere</li> |
| | | <li>Das Attribut <code>display</code> lässt sich jedoch nicht animieren</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Syntax</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | .foo { |
| | | width: 100%; |
| | | background-color: red; |
| | | /* transition: [Attribut] [Dauer] [Zeitfunktion] */ |
| | | transition: width 1s ease-out; |
| | | } |
| | | |
| | | .foo:hover { |
| | | width: 50%; |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <iframe data-src="/assets/html/css-transition.html"></iframe> |
| | | </section> |
| | | <section> |
| | | <h3>Animation</h3> |
| | | <ul> |
| | | <li>Es können zusätzlich eigene Animationen entworfen werden</li> |
| | | <li>Definition per <code>Keyframes</code></li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Syntax</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | .foo { |
| | | animation-duration: 3s; |
| | | animation-name: slidein; |
| | | } |
| | | |
| | | @keyframes slidein { |
| | | from { |
| | | margin-left: 100%; |
| | | width: 300%; |
| | | } |
| | | |
| | | to { |
| | | margin-left: 0%; |
| | | width: 100%; |
| | | } |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Alternative Syntax</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | .foo { |
| | | /* ... */ |
| | | } |
| | | |
| | | @keyframes slidein { |
| | | 1% { |
| | | margin-left: 100%; |
| | | } |
| | | |
| | | 100% { |
| | | margin-left: 0%; |
| | | } |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <iframe data-src="/assets/html/css-animation.html"></iframe> |
| | | </section> |
| | | <section> |
| | | <h3>3D Transform</h3> |
| | | <ul> |
| | | <li>Neben den gewohnten X- und Y-Achsen (Breite und Höhe) gibt es auch noch die Z-Achse</li> |
| | | <li>Bewegung entlang der Sichtachse, d.h. zum bzw. vom Betrachter weg</li> |
| | | <li>Perspektivische Effekte möglich</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <iframe data-src="/assets/html/css-transform-3d.html"></iframe> |
| | | </section> |
| | | <section> |
| | | <h3>Bedingungen / Optionen</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | .container { |
| | | perspective: 1000px; /* "Entfernung" des Betrachters */ |
| | | |
| | | transform-style: preserve-3d; /* oder "flat" */ |
| | | } |
| | | |
| | | .element { |
| | | backface-visibility: hidden; /* oder "visible" */ |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <iframe data-src="/assets/html/css-transform-3d-cube.html"></iframe> |
| | | </section> |
| | | <section> |
| | | <h3>Aufgabe</h3> |
| | | <p>Implementiere einen drehenden Würfel (Vorlage ".html")</p> |
| | | </section> |
| | | </section> |
| | | </div> |
| | | </div> |