From 86d082d477c55e50dd8723339802afeaa083b595 Mon Sep 17 00:00:00 2001 From: Sascha Schulz <sschulz@dh-software.de> Date: Di, 31 Jan 2023 15:50:56 +0100 Subject: [PATCH] add css box model and position --- index.html | 278 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 255 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index bbf2946..d8c9910 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ <link rel="stylesheet" href="dist/theme/night-custom.css"> <!-- Theme used for syntax highlighted code --> - <link rel="stylesheet" href="plugin/highlight/monokai.css"> + <link rel="stylesheet" href="./node_modules/highlight.js/styles/atom-one-dark-reasonable.css"> </head> <body> <div class="reveal"> @@ -90,9 +90,11 @@ </section> <section> <ul> + <li>HyperText Markup Language</li> <li>Erste Version 1993 von Tim Berners-Lee</li> <li>Dokumentationsmedium</li> <li>Ursprünglich rein akademische Verwendung</li> + <li>Verlinkungen der Dokumente macht sie "hyper"</li> </ul> </section> <section> @@ -114,7 +116,7 @@ <section> <h3>Grundgerüst</h3> <pre> - <code data-trim data-line-numbers> + <code class="html" data-trim data-line-numbers> <script type="text/template"> <!DOCTYPE html> <html lang="de"> @@ -129,30 +131,21 @@ </pre> </section> <section> - <h3>Grundgerüst</h3> - <pre> - <code data-trim data-line-numbers> - <script type="text/template"> - <div>Inhalt</div> - </script> - </code> - </pre> - </section> - <section> <h3>Beispiel</h3> <pre> - <code data-trim data-line-numbers> + <code class="html" data-trim data-line-numbers> <script type="text/template"> <!DOCTYPE html> - <html lang="de"> + <html lang="en"> <head> <meta charset="UTF-8"> + <title>Title</title> </head> <body> - <h1>Überschrift</h1> + <h1>Lorem Ipsum</h1> <div> - <p>Dies ist ein Paragraph</p> - <p>Dies ist noch ein Paragraph mit einem längeren Text</p> + <p>Lorem ipsum dolor sit amet, consectetuer adipiscing</p> + <a href="/assets/html/simple2.html">Weitere Infos</a> </div> </body> </html> @@ -162,13 +155,252 @@ </section> <section> <h3>Beispiel</h3> + <iframe data-src="/assets/html/simple.html"></iframe> + </section> + <section> + <h3>Aufbau eines Elements</h3> <pre> - <code> - <h1>Überschrift</h1> - <div> - <p>Dies ist ein Paragraph</p> - <p>Dies ist noch ein Paragraph mit einem längeren Text</p> - </div> + <code class="html" data-trim> + <script type="text/template"> + <span id="my-id" class="super important">Inhalt</span> + </script> + </code> + </pre> + <pre> + <code class="html" data-trim> + <script type="text/template"> + <!-- HTML 4.01 --> + <input id="input" class="super important" disabled="disabled" /> + </script> + </code> + </pre> + <pre> + <code class="html" data-trim> + <script type="text/template"> + <!-- HTML 5 --> + <input id="input2" class="super important" disabled> + </script> + </code> + </pre> + </section> + </section> + <section> + <section> + <h2>CSS</h2> + </section> + <section> + <ul> + <li>Cascading Style Sheet</li> + <li>Nach größerer Verbreitung von HTML</li> + <li>Webseiten ansprechend gestalten</li> + </ul> + </section> + <section> + <img data-src="/assets/images/css-sucks.png"> + </section> + <section> + <h3>Beispiel</h3> + <pre> + <code class="css" data-trim data-line-numbers> + selector [, selector, selector, ...] { + property: value; + } + </code> + </pre> + </section> + <section> + <h3>Beispiel</h3> + <pre> + <code class="css" data-trim data-line-numbers> + html { + background-color: red; + font-size: 30px; + } + </code> + </pre> + </section> + <section> + <h3>Beispiel</h3> + <pre> + <code class="html" data-trim data-line-numbers> + <script type="text/template"> + <html lang="en"> + <head> + ... + <style> + html { + background-color: red; + font-size: 30px; + } + </style> + </head> + <body> + ... + </body> + </html> + </script> + </code> + </pre> + </section> + <section> + <h3>Beispielhafte CSS-Eigenschaften</h3> + <ul> + <li>background-color: red</li> + <li>font-family: Georgia, serif, Arial</li> + <li>text-decoration: line-through underline</li> + </ul> + </section> + <section> + <h3>Selektoren</h3> + <ul> + <li>Umfangreiche Element-Selektoren zur Anwendung der Styles</li> + <li>Kinder, Enkel...</li> + <li>Geschwister, direkte Nachfolger</li> + <li>Attribute</li> + <li>Pseudoklassen</li> + </ul> + </section> + <section> + <h3>Selektoren</h3> + <pre> + <code class="css" data-trim data-line-numbers> + #my-id /* ID */ + html, body /* Mehrfachselektion */ + div > p /* p die direkt unterhalb eines div sind */ + a:visited /* besuchte Links */ + span.important /* span mit der Klasse "important" */ + </code> + </pre> + </section> + <section> + <h3>Layout</h3> + <p>Es gibt zwei grundlegende Blocktypen:</p> + <p><code>block</code></p> + <p><code>inline</code></p> + </section> + <section> + <h3>Block</h3> + <p>Beansprucht eine ganze Zeile und verursacht Zeilenumbrüche</p> + <pre> + <code class="css" data-trim data-line-numbers> + display: block; + </code> + </pre> + </section> + <section> + <p>Kann Breite und Höhe haben</p> + <pre> + <code class="css" data-trim data-line-numbers> + display: block; + width: 20px; + height: 20px; + </code> + </pre> + </section> + <section> + <h3>Inline</h3> + <p>Wie einfacher Text, der mit anderen in der gleichen Zeile stehen kann</p> + <pre> + <code class="css" data-trim data-line-numbers> + display: inline; + </code> + </pre> + </section> + <section> + <p>Festlegen von Breite und Höhe sind wirkungslos</p> + <pre> + <code class="css" data-trim data-line-numbers> + display: inline; + width: 20px; /* kein Effekt */ + height: 20px; /* kein Effekt */ + </code> + </pre> + </section> + <section> + <h3>Inline-Block</h3> + <p>Mischform von <code>inline</code> und <code>block</code></p> + <pre> + <code class="css" data-trim data-line-numbers> + display: inline-block; + width: 20px; + height: 20px; + </code> + </pre> + </section> + <section> + <h3>Box Model</h3> + <p>Es gibt zwei Varianten des Modells:</p> + <p><code>content-box</code> (default)</p> + <p>border-box</p> + <pre> + <code class="css" data-trim data-line-numbers> + box-sizing: content-box; + box-sizing: border-box; + </code> + </pre> + </section> + <section> + <img data-src="/assets/images/css-box-model.png"> + </section> + <section> + <h3>Beispiel</h3> + <pre> + <code class="css" data-trim data-line-numbers> + div { + border: 3px solid red; + padding: 10px; + width: 100px; + } + + .border-box { + box-sizing: border-box; + } + + .content-box { + box-sizing: content-box; + } + </code> + </pre> + <pre> + <code class="html" data-trim data-line-numbers> + <script type="text/template"> + <div class="content-box">content-box</div> + <div class="border-box">border-box</div> + </script> + </code> + </pre> + </section> + <section> + <h3>Beispiel</h3> + <iframe data-src="/assets/html/box-sizing.html"></iframe> + </section> + <section> + <h3>Positioning</h3> + <pre> + <code class="css" data-trim data-line-numbers> + /* default, da wo es in der Seite steht */ + position: static; + /* relativ zu seiner eigentlichen Position */ + position: relative; + /* relativ zu seinem nächsten non-static parent o. window */ + position: absolute; + </code> + </pre> + </section> + <section> + <pre> + <code class="css" data-trim data-line-numbers> + position: relative; + position: absolute; + </code> + </pre> + <p>erlauben Verschiebung mittels</p> + <pre> + <code class="css" data-trim data-line-numbers> + top: 10px; + left: 10px; + right: 10px; + bottom: 10px; </code> </pre> </section> -- Gitblit v1.9.3