CSS Cascading Style Sheets Varfr CSS Ltt att

  • Slides: 121
Download presentation
CSS Cascading Style Sheets

CSS Cascading Style Sheets

Varför CSS • • • Lätt att underhålla Mindre filstorlekar Ökad tillgänglighet Olika media

Varför CSS • • • Lätt att underhålla Mindre filstorlekar Ökad tillgänglighet Olika media Större typografisk kontroll

INTRO TILL CSS L 2

INTRO TILL CSS L 2

<!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3.

<!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -strict. dtd"> <html xmlns="http: //www. w 3. org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>L 2</title> </head> <body> <h 1>Rubrik nivå 1</h 1> <h 2>Rubrik nivå 2</h 2> <p> Lorem ipsum. . . </p> </body>

CSS-fil: L 2. CSS h 1 { text-align: center; } h 2 { font-style:

CSS-fil: L 2. CSS h 1 { text-align: center; } h 2 { font-style: italic; } p { color: maroon; } <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>L 2</title> <link href="L 2. css" rel="stylesheet" type="text/css" /> </head>

Deklarationer • h 1 { text-align: center; } • h 2 { font-style: italic;

Deklarationer • h 1 { text-align: center; } • h 2 { font-style: italic; } • p { color: maroon; }

Kommentar, kombinerade selektorer @charset "utf-8"; h 1, h 2 { text-align: center; color: #007

Kommentar, kombinerade selektorer @charset "utf-8"; h 1, h 2 { text-align: center; color: #007 FFF; /*Färgerna anges som RR GG BB*/ } h 2 { font-style: italic; } p { color: maroon; }

Formattera font h 2 { font-style: italic; font-variant: small-caps; font-weight: bold; font-size: 100%; line-height:

Formattera font h 2 { font-style: italic; font-variant: small-caps; font-weight: bold; font-size: 100%; line-height: 120%; font-family: Arial, Helvetica, sans-serif; }

Kantlinjer h 1 { border-width: 1 px; border-style: dashed; border-color: red; }

Kantlinjer h 1 { border-width: 1 px; border-style: dashed; border-color: red; }

Padding p { color: maroon; padding-top: 1 em; padding-right: 2 em; padding-bottom: 3 em;

Padding p { color: maroon; padding-top: 1 em; padding-right: 2 em; padding-bottom: 3 em; padding-left: 4 em; border-width: 1 px; border-style: solid; border-color: blue; line-height: 130%; }

Margin p { color: maroon; margin-top: 1 em; margin-bottom: 3 em; border-width: 1 px;

Margin p { color: maroon; margin-top: 1 em; margin-bottom: 3 em; border-width: 1 px; border-style: solid; border-color: blue; line-height: 130%; }

STILMALLAR 3 sätt att stila på L 4

STILMALLAR 3 sätt att stila på L 4

In-line-kod <h 1>Rubrik 1</h 1> <p style="font-family: Arial, Helvetica, sans-serif; margin: 15 px; padding:

In-line-kod <h 1>Rubrik 1</h 1> <p style="font-family: Arial, Helvetica, sans-serif; margin: 15 px; padding: 1 em; backgroundcolor: gray; width: 10 em; color: yellow"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p> (4 a)

Rubrikformat <title>L 4</title> <style type="text/css" media="screen"> p { font-family: Arial, Helvetica, sans-serif; margin: 15

Rubrikformat <title>L 4</title> <style type="text/css" media="screen"> p { font-family: Arial, Helvetica, sans-serif; margin: 15 px; padding: 1 em; background-color: red; width: 10 em; color: black; } </style> </head>

Extern stilmall @charset "utf-8"; p { font-family: Arial, Helvetica, sans-serif; margin: 15 px; padding:

Extern stilmall @charset "utf-8"; p { font-family: Arial, Helvetica, sans-serif; margin: 15 px; padding: 1 em; background-color: gray; width: 10 em; color: white; } h 1 { margin: 15 px; }

Box-modellen L 5

Box-modellen L 5

Box-modellen <div id="content"> <h 1> Rubrik 1 </h 1> <p> Lorem. . . </p>

Box-modellen <div id="content"> <h 1> Rubrik 1 </h 1> <p> Lorem. . . </p> </div> #content {margin: 10 px; border: 5 px solid gray; background-color: blue; width: 200 px; padding: 25 px; } p {font-family: Arial, Helvetica, sans-serif; margin: 15 px; padding: 10 px; background-color: gray; margin: 20 px; border: 10 px dashed white; background-color: red; width: 120 px; } h 1 {color: white; }

Selektorer

Selektorer

Selektor { egenskap: värde; } @charset "utf-8"; /* CSS Document */ p {color: black;

Selektor { egenskap: värde; } @charset "utf-8"; /* CSS Document */ p {color: black; } p em {color: green; } div p {color: red; }. special{background-color: #999999;

<body> <h 1>Detta är <em>första</em> rubriken </h 1> <p>Och här kommer <em>brödtexten</em> </p> <p>Lorem

<body> <h 1>Detta är <em>första</em> rubriken </h 1> <p>Och här kommer <em>brödtexten</em> </p> <p>Lorem ipsum … </p> <div><p>Ut wisi enim ad minim … </p></div> <h 1 class="special">Detta är <em>andra</em>rubriken </h 1> <p class="special">Nam liber tempor </p> <p>Claritas est etiam. </p> </body>

ID-selektrorer p {color: black; } p#vanlig{color: blue; } p#vanlig em {color: green; } div

ID-selektrorer p {color: black; } p#vanlig{color: blue; } p#vanlig em {color: green; } div p {color: red; }. special{background-color: #999999; } #speciell{background-color: #999900; } h 1#first_header {border: dotted} * {color: maroon}

<body> <h 1 id="first_header">Detta är <em>första</em> rubriken </h 1> <p id="vanlig">Och här kommer <em>brödtexten</em>

<body> <h 1 id="first_header">Detta är <em>första</em> rubriken </h 1> <p id="vanlig">Och här kommer <em>brödtexten</em> </p> <p>Lorem ipsum dolor … </p> <div id="speciell"><p>Ut wisi enim … </p></div> <h 1 class="special">Detta är <em>andra</em>rubriken </h 1> <p class="special">Nam liber tempor …. </p> <p>Claritas est etiam …. </p> </body>

Pseudoelement • p: first-letter {font-size: 36 px} • p: first-line {font-size: 24 px}

Pseudoelement • p: first-letter {font-size: 36 px} • p: first-line {font-size: 24 px}

Att manipulera text @charset "utf-8"; /* CSS Document */ p#vanlig{} p#indent{text-indent: 25 px; }

Att manipulera text @charset "utf-8"; /* CSS Document */ p#vanlig{} p#indent{text-indent: 25 px; } p#space{letter-spacing: 0. 25 em; } p#height{line-height: 150%; } p#transform{ text-transform: uppercase; }

Position static p#third{ position: static; }

Position static p#third{ position: static; }

Position relative p{border: 1 px solid #333333; } p#first{} p#second{} p#third{ position: relative; left:

Position relative p{border: 1 px solid #333333; } p#first{} p#second{} p#third{ position: relative; left: 20 px; top: 30 px; } p#fourth{}

Position absolute – rel dok @charset "utf-8"; /* CSS Document */ p{ border: 1

Position absolute – rel dok @charset "utf-8"; /* CSS Document */ p{ border: 1 px solid #333333; } p#first{} p#second{} p#third{ border: 1 px solid #f 00; position: absolute; left: 20 px; top: 30 px; color: red; } p#fourth{}

Position Fixed – rel browser @charset "utf-8"; /* CSS Document */ p{ border: 1

Position Fixed – rel browser @charset "utf-8"; /* CSS Document */ p{ border: 1 px solid #333333; } p#first{} p#second{} p#third{ border: 1 px solid #f 00; position: fixed; left: 20 px; top: 30 px; color: red; font-weight: bolder; } p#fourth{}

Float • <img src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20415%20289%22%3E%3C/svg%3E' data-src="godis. jpg" alt="godis"> • <p id="first">Lorem ipsum dolor sit amet, consectetuer

Float • <img src="godis. jpg" alt="godis"> • <p id="first">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p> • <p id="second">Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel …

@charset "utf-8"; /* CSS Document */ p{ } img{ margin: 10 px; } p#first{}

@charset "utf-8"; /* CSS Document */ p{ } img{ margin: 10 px; } p#first{} p#second{} p#third{} p#fourth{}

Float left • • • • @charset "utf-8"; /* CSS Document */ p{ }

Float left • • • • @charset "utf-8"; /* CSS Document */ p{ } img{ margin: 10 px; float: left } p#first{} p#second{} p#third{} p#fourth{}

@charset "utf-8"; /* CSS Document */ p{ float: right } img{ margin: 10 px;

@charset "utf-8"; /* CSS Document */ p{ float: right } img{ margin: 10 px; float: right } p#first{} p#second{} p#third{} p#fourth{}

Display <body> <img src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20415%20289%22%3E%3C/svg%3E' data-src="godis 2. jpg" alt="godis"><img src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20415%20289%22%3E%3C/svg%3E' data-src="godis 2. jpg" alt="godis"> </body> img{ display:

Display <body> <img src="godis 2. jpg" alt="godis"><img src="godis 2. jpg" alt="godis"> </body> img{ display: inline; } margin: 10 px;

} img{ display: block; } margin: 10 px;

} img{ display: block; } margin: 10 px;

Bakgrundsbild

Bakgrundsbild

<div id="content"> <h 1> Rubrik 1</h 1> <p> Lorem. . . </p> </div>

<div id="content"> <h 1> Rubrik 1</h 1> <p> Lorem. . . </p> </div>

@charset "utf-8"; #content { background-image: url(book_600. jpg); margin: 50 px; width: 500 px; padding-top:

@charset "utf-8"; #content { background-image: url(book_600. jpg); margin: 50 px; width: 500 px; padding-top: 0 px; padding-left: 95 px; padding-below: 25 px; } p { font-family: Arial, Helvetica, sans-serif; margin: 15 px; padding: 30 px; padding-top: 10 px; margin: 20 px; width: 120 px; } h 1 { font-family: Arial, Helvetica, sans-serif; margin: 15 px; padding: 2 px; padding-top: 10 px; padding-left: 30 px; margin: 20 px; width: 120 px; }

Upprepad bild #content { background-image: url(book_600_1. jpg); background-repeat: repeat-y; margin: 50 px; width: 500

Upprepad bild #content { background-image: url(book_600_1. jpg); background-repeat: repeat-y; margin: 50 px; width: 500 px; padding-top: 0 px; padding-left: 95 px; padding-below: 25 px; }

<h 1 id="header">Sidans rubrik</h 1> <p> Lorem ipsum. . . </p> @charset "utf-8"; h

<h 1 id="header">Sidans rubrik</h 1> <p> Lorem ipsum. . . </p> @charset "utf-8"; h 1#header { color: #036; font-size: 120%; font-weight: normal; text-transform: uppercase; text-align: center; letter-spacing: . 5 em; padding: . 4 em 0; border-top: 1 px solid #069; border-bottom: 1 px solid #069; background: url(bild. jpg) repeat-x; }

”Fotoalbum” L 12

”Fotoalbum” L 12

<div class="thumbnail"> <img src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20415%20289%22%3E%3C/svg%3E' data-src="Bild 1 -100. jpg" alt="bild 1" /> <p>Första bilden</p> </div> <div

<div class="thumbnail"> <img src="Bild 1 -100. jpg" alt="bild 1" /> <p>Första bilden</p> </div> <div class="thumbnail"> <img src="Bild 2 -100. jpg" alt="bild 2" /> <p>Andra bilden</p> </div> <div class="thumbnail"> <img src="Bild 3 -100. jpg" alt="bild 3" /> <p>Tredje bilden</p> </div> <div class="thumbnail"> <img src="Bild 4 -100. jpg" alt="bild 4" /> <p>Fjärdebilden</p> </div> <div class="thumbnail"> <img src="Bild 5 -100. jpg" alt="bild 5" /> <p>Femte bilden</p> </div> @charset "utf-8"; div. thumbnail { width: 130 px; float: left; margin: 0 10 px 0; background: url(Bild_bak. jpg) norepeat; }

<div class="thumbnail"> <img src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20415%20289%22%3E%3C/svg%3E' data-src="Bild 1 -100. jpg" alt="bild 1" /> <p>Första bilden</p> </div> <div

<div class="thumbnail"> <img src="Bild 1 -100. jpg" alt="bild 1" /> <p>Första bilden</p> </div> <div class="thumbnail"> <img src="Bild 2 -100. jpg" alt="bild 2" /> <p>Andra bilden</p> </div> <div class="thumbnail clear"> <img src="Bild 3 -100. jpg" alt="bild 3" /> <p>Tredje bilden</p> </div> <div class="thumbnail"> <img src="Bild 4 -100. jpg" alt="bild 4" /> <p>Fjärdebilden</p> </div> <div class="thumbnail clear"> <img src="Bild 5 -100. jpg" alt="bild 5" /> <p>Femte bilden</p> </div> div. thumbnail {width: 130 px; float: left; margin: 0 10 px 0; background: url(Bild_bak. jpg) no-repeat; } div. thumbnail img {margin: 10 px 0 0 10 px; border: 1 px solid #777; } div. thumbnail p { margin: 0; padding: 0 20 px 10 px; background: url(Bild_bak. jpg) no-repeat 0 100%; }. clear { clear: left; }

div. thumbnail {float: left; width: 250 px; margin: 0 10 px 0; padding-bottom: 10

div. thumbnail {float: left; width: 250 px; margin: 0 10 px 0; padding-bottom: 10 px; border: 1 px solid #777; } div. thumbnail img {float: left; border: 1 px solid #777; margin: 10 px 0 10 px; } div. thumbnail p { margin: 0; padding: 10 px; } <div class="thumbnail"> <img src="Bild 1 -100. jpg" alt="bild 1" /> <p>Första bilden</p> </div> <div class="thumbnail"> <img src="Bild 2 -100. jpg" alt="bild 2" /> <p>Andra bilden</p> </div> <div class="thumbnail"> <img src="Bild 3 -100. jpg" alt="bild 3" /> <p>Tredje bilden</p> </div> <div class="thumbnail"> <img src="Bild 4 -100. jpg" alt="bild 4" /> <p>Fjärdebilden</p> </div> <div class="thumbnail"> <img src="Bild 5 -100. jpg" alt="bild 5" /> <p>Femte bilden</p> </div>

Citat L 13

Citat L 13

<blockquote> <p>Lorem ipsum. . </p> <p class="source"> Julias Caesar </p> </blockquote> </body> </html>

<blockquote> <p>Lorem ipsum. . </p> <p class="source"> Julias Caesar </p> </blockquote> </body> </html>

blockquote { margin: 1 em 0; border: 1 px solid #ddd; background: url(13. jpg)

blockquote { margin: 1 em 0; border: 1 px solid #ddd; background: url(13. jpg) 5 px no-repeat; padding-top: 30 px; } blockquote p { padding: 0 70 px; } <body> <blockquote> <p>Lorem ipsum. . . </p> <p class="source"> Julias Caesar </p> </blockquote> blockquote p. source { background: url(13 b. jpg) norepeat 100%; padding-bottom: 30 px; margin: 0 5 px 0; text-align: right; font-style: italic; } </body>

@charset "utf-8"; blockquote { margin: 1 em 0; border: 1 px solid #000; background:

@charset "utf-8"; blockquote { margin: 1 em 0; border: 1 px solid #000; background: #000 url(13 c. jpg) no-repeat 0 0; padding-top: 1 px; color: #fff; /*width: 500 px; */} blockquote p { padding: 0 1 em 0 80 px; } blockquote p. source { margin: 0; border-top: 5 px solid #fff; padding: . 5 em 80 px; background: #336; font-style: italic; }

Runda hörn L 17

Runda hörn L 17

<body> <div id="pullquote"> <h 2>Rubriken</h 2> <P>Lorem ipsum. . . </P> <p class="furtherinfo" >

<body> <div id="pullquote"> <h 2>Rubriken</h 2> <P>Lorem ipsum. . . </P> <p class="furtherinfo" > <a href="#">mer info</a> </p> </div> </body> div#pullquote {margin: 2 em; background: #00069 c url(Bild_17 a. jpg) no-repeat; } div#pullquote h 2 {margin: 0; padding: 20 px 0 20 px; background: url(Bild_17 b. jpg) no-repeat 100% 0; color: #2 ABFFF; } div#pullquote p {padding: 0 20 px ; color: #2 ABFFF; } div#pullquote p. furtherinfo {padding: 0 0 0 20 px; background: url(Bild_17 d. jpg) no-repeat 0 100%; } div#pullquote p. furtherinfo a {padding: 0 20 px 0; text-align: right; background: url(Bild_17 c. jpg) no-repeat 100%; color: #2 ABFFF; }

Länkar L 10

Länkar L 10

Länkar – 5 tillstånd • Normal a: link • Visited a: visited • Hover

Länkar – 5 tillstånd • Normal a: link • Visited a: visited • Hover a: hover • • Active a: active Focus a: focus

<p> Lorem ipsum dolor sit amet, <a href="L 8. html">consectetur </a>adipisicing elit, sed do

<p> Lorem ipsum dolor sit amet, <a href="L 8. html">consectetur </a>adipisicing elit, sed do eiusmod tempor incididunt ut labore <a href="L 8. html">et dolore magna</a> aliqua. Ut enim ad <a href="http: //www. tfe. umu. se">mini m veniam</a>, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum </p> a{color: blue; } a: link {color: red; } a: visited {color: green; } a: hover {color: black; font-weight: bold; text-decoration: none; border-bottom: 1 px solid blue; padding: . 4 em 0; position: relative; background: yellow; }

Tabeller L 14

Tabeller L 14

<table> <caption> Prislista för maskinskruv, trådspik, bultar och fjäderbrickor </caption> <tr> <td>Detalj</td> <td>Maskinskruv</td> <td>Trådspik</td>

<table> <caption> Prislista för maskinskruv, trådspik, bultar och fjäderbrickor </caption> <tr> <td>Detalj</td> <td>Maskinskruv</td> <td>Trådspik</td> <td>Bultar</td> <td>Fjäderbrickor</td> </tr> <td>1 kg</td> <td>2. 50</td> <td>3. 50</td> <td>4. 50</td> <td>2. 50</td> </tr> <td>2 kg</td> <td>3. 00</td>

<table summary="Tabell med skruv, spik, bult och bricksor för 1 till 4 kilo"> <caption>

<table summary="Tabell med skruv, spik, bult och bricksor för 1 till 4 kilo"> <caption> Prislista för maskinskruv, trådspik, bultar och fjäderbrickor </caption> <thead> <th>Detalj</th> <th>Maskinskruv</th> <th>Trådspik</th> <th>Bultar</th> <th>Fjäderbrickor</th> </thead> <tbody> <tr> <td>1 kg</td> <td>2. 50</td> <td>3. 50</td> <td>4. 50</td> <td>2. 50</td> </tr> <td>2 kg</td> <td>3. 00</td>

@charset "utf-8"; caption {text-align: left; margin: 0 0. 5 em 0; font-weight: bold; }

@charset "utf-8"; caption {text-align: left; margin: 0 0. 5 em 0; font-weight: bold; } table {border-collapse: collapse; } th, td {border-right: 1 px solid #fff; border-bottom: 1 px solid #fff; padding: . 5 em; } tr {background: #B 0 C 4 D 7; }

<table summary="Tabell med skruv, spik, bult och bricksor för 1 till 4 kilo"> <caption>

<table summary="Tabell med skruv, spik, bult och bricksor för 1 till 4 kilo"> <caption> Prislista för maskinskruv, trådspik, bultar och fjäderbrickor </caption> <thead> <th>Detalj</th> <th abbr="skruv">Maskinskruv</th> <th abbr="spik">Trådspik</th> <th abbr="bultv">Bultar</th> <th abbr="brickor">Fjäderbrickor</th> </thead> <tbody> <tr> <th>1 kg</th> <td>2. 50</td> <td>3. 50</td> <td>4. 50</td> <td>2. 50</td> </tr> <th>2 kg</th> <td>3. 00</td> <td>4. 00</td> <td>5. 00</td> <td>3. 00</td> </tr> <th>3 kg</th> <td>3. 50</td> caption {text-align: left; margin: 0 0. 5 em 0; font-weight: bold; } Table {border-collapse: collapse; } th, td {border-right: 1 px solid #fff; border-bottom: 1 px solid #fff; padding: . 5 em; } Tr {background: #B 0 C 4 D 7; } thead th { background: #036; color: #fff; } tbody th { font-weight: normal; background: #658 CB 1; }

<tr class="alternate"> <th>2 kg</th> <td>3. 00</td> <td>4. 00</td> <td>5. 00</td> <td>3. 00</td> </tr> tr.

<tr class="alternate"> <th>2 kg</th> <td>3. 00</td> <td>4. 00</td> <td>5. 00</td> <td>3. 00</td> </tr> tr. alternate { background: #D 7 E 0 EA; } tr. alternate th { background: #8 AA 9 C 7; }

Att disponera sidan

Att disponera sidan

Tvåspaltig sidlayout – inte ännu

Tvåspaltig sidlayout – inte ännu

<body> <div id="nav"> <ul> <li><a href="#">Länk 1 </a></li> <li><a href="#">Länk 2 </a></li> <li><a href="#">Länk

<body> <div id="nav"> <ul> <li><a href="#">Länk 1 </a></li> <li><a href="#">Länk 2 </a></li> <li><a href="#">Länk 3 </a></li> </ul> </div> <div id="content"> <h 1>Tvåspaltig design</h 1> <p>Lorem ipsum dolor sit amet, </p> </div> </body>

body{ margin: 0 px; padding: 0 px; } div#nav{ position: absolute; width: 150 px;

body{ margin: 0 px; padding: 0 px; } div#nav{ position: absolute; width: 150 px; border-top-width: 0 px; border-right-width: 2 px; border-bottom-width: 0 px; border-left-width: 0 px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-right-color: #CC 0000; } div#content{margin-left: 150 px; }

body{ margin: 0 px; padding: 0 px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 1

body{ margin: 0 px; padding: 0 px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 1 em; } div#nav{ position: absolute; width: 150 px; left: 0 px; top: 0 px; margin-top: 22 px; margin-left: 15 px; padding-top: . 5 em; border-top-width: 2 px; border-bottom-width: 1 px; border-top-style: solid; border-bottom-style: solid; border-top-color: #069; border-bottom-color: #069; }

div#nav ul{ margin-top: 0 px; margin-bottom: . 8 em; } div#nav li{ font-size: .

div#nav ul{ margin-top: 0 px; margin-bottom: . 8 em; } div#nav li{ font-size: . 75 em; font-weight: bold; } div#content{ margin-left: 165 px; margin-top: 20 px; padding-right: 1 em; padding-bottom: 0 px; padding-left: 1 em; }

Trespaltig med float och div

Trespaltig med float och div

<body> <div id="header"><h 1>Detta är rubriken</h 1></div> <div id="content"> <div id="spalt 1"><p>Claritas est …

<body> <div id="header"><h 1>Detta är rubriken</h 1></div> <div id="content"> <div id="spalt 1"><p>Claritas est … </p></div> <div id="spalt 2"><p>Claritas est etiam … </p></div> <div id="spalt 3"><p>Nam liber tempor cum … </p> </div> <div class="bryt"></div> <div id="foot">Sidfot med exempelvis författarnamn</div> </body>

body{ margin: 0 px; padding: 0 px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 1

body{ margin: 0 px; padding: 0 px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 1 em; } #content{width: 450 px; border: solid; } div. bryt{clear: both} #header{ color: #CC 0000; width: 450 px; } #spalt 1{ color: #CC 9900; width: 150 px; float: left; }

Vertikal meny L 15

Vertikal meny L 15

ul#navigation {margin-left: 0; padding-left: 0; list-style-type: none; } ul#navigation a {display: block; text-decoration: none;

ul#navigation {margin-left: 0; padding-left: 0; list-style-type: none; } ul#navigation a {display: block; text-decoration: none; background: #036; color: #fff; padding: . 2 em. 5 em; border-bottom: 1 px solid #fff; width: 7 em; } ul#navigation a: hover {background: #69 C; color: #000; }

<ul id="navigation"> <li><a href="#">Hem</a></li> <li><a href="#">Om</a></li> <li><a href="#">Tjänster</a></li> <li><a href="#">Personal</a></li> <li><a href="#">Portfölj</a></li> <li><a href="#">Kontakt</a></li>

<ul id="navigation"> <li><a href="#">Hem</a></li> <li><a href="#">Om</a></li> <li><a href="#">Tjänster</a></li> <li><a href="#">Personal</a></li> <li><a href="#">Portfölj</a></li> <li><a href="#">Kontakt</a></li> <li><a href="#">Webbkartan</a></li> </ul> ul#navigation {margin-left: 0; padding-left: 0; list-style-type: none; } ul#navigation a {display: block; text-decoration: none; background: #036; color: #fff; padding: . 2 em. 5 em; border-bottom: 1 px solid #fff; width: 7 em; }

Horisontell meny L 16

Horisontell meny L 16

body{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 1 em; } * {margin: 0; padding:

body{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 1 em; } * {margin: 0; padding: 0; } div#vertmenu{ width: 100%; font-size: . 8 em; background-color: #CCF; margin-top: 20 px; border-top-width: 1 px; border-bottom-width: 1 px; border-top-style: solid; border-bottom-style: solid; border-top-color: #069; border-bottom-color: #069; } div#vertmenu ul{ margin-left: 30 px; } div#vertmenu li{ background-color: #FFA; float: left; }

 • <ul id="navigation"> • <li><a href="#">Hem</a></li> • <li><a href="#">Om</a></li> • <li><a href="#">Tjänster</a></li> •

• <ul id="navigation"> • <li><a href="#">Hem</a></li> • <li><a href="#">Om</a></li> • <li><a href="#">Tjänster</a></li> • <li><a href="#">Personal</a></li> • <li><a href="#">Portfölj</a></li> • <li><a href="#">Kontakt</a></li> • <li><a href="#">Webbkartan</a></li> • </ul>

ul#navigation {margin-left: 0; padding-left: 0; list-style-type: none; background: #036; float: left; width: 100%; }

ul#navigation {margin-left: 0; padding-left: 0; list-style-type: none; background: #036; float: left; width: 100%; } ul#navigation a {display: block; float: left; padding: . 2 em 1 em; color: #fff; text-decoration: none; background: #036; border-right: 1 px solid #fff; } ul#navigation li {display: inline; } ul#navigation a: hover {background: #69 C; color: #000; }

En fin rubrik L 18

En fin rubrik L 18

<div id="container"> <h 1> <a href="/"><img src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20415%20289%22%3E%3C/svg%3E' data-src="fyrfolket. jpg" alt="Platsnamn" ></a> </h 1> <ul id="topnav">

<div id="container"> <h 1> <a href="/"><img src="fyrfolket. jpg" alt="Platsnamn" ></a> </h 1> <ul id="topnav"> <li><a href="#">Direkt till innehållet</a></li> <li><a href="#">Hem</a></li> <li><a href="#">Om</a></li> <li><a href="#">Tjänster</a></li> <li><a href="#">Medarbetare</a></li> <li><a href="#">Portfölj</a></li> <li><a href="#">Kontakt</a></li> </ul> </div>

@charset "utf-8"; body {margin: 0; padding: 0; text-align: center; background: #B 0 BFC 2;

@charset "utf-8"; body {margin: 0; padding: 0; text-align: center; background: #B 0 BFC 2; color: #444} #container {text-align: left; margin: 0 auto; width: 700 px; background: #fff; } h 1 {margin: 0; padding: 0; border-bottom: 1 px solid #fff; } h 1 img {display: block; border: 0; } ul#topnav {margin: 0; padding: 5 px 10 px; list-style-type: none; background: #387 a 9 b; } ul#topnav li {display: inline; background: url(header-bullet. jpg) norepeat 0 50%; padding: 0 5 px 0 20 px; } ul#topnav li a: link, ul#topnav li a: visited {text-decoration: none; color: #fff; } ul#topnav li a: hover, ul#topnav li a: active {text-decoration: none; color: #387 a 9 b; background: #fff; }

Två spaler rubrik och footer L 19

Två spaler rubrik och footer L 19

<div id="container"> <h 1>Fyrfolket</h 1> <div id="nav"> <ul> <li><a href="#">Direkt </a></li> <li><a href="#">Hem</a></li> <li><a

<div id="container"> <h 1>Fyrfolket</h 1> <div id="nav"> <ul> <li><a href="#">Direkt </a></li> <li><a href="#">Hem</a></li> <li><a href="#">Om</a></li> <li><a href="#">Tjänster</a></li> <li><a href="#">Medarbetare</a></li> <li><a href="#">Portfölj</a></li> <li><a href="#">Kontakta oss</a></li> </ul> </div> <div id="content"> <h 2>Om Stora Fjäderäggs fyrplats</h 2> <p>Lorem ipsum dolor sit amet, in torquent nunc pretium pharetra. . </p> <p>Dui nunc dui ultrices nulla. . . </p> </div> <div id="footer"> Copyright © webbplatsen 2006 </div>

body {text-align: center; background: #B 0 BFC 2; color: #444} #container {text-align: left; margin:

body {text-align: center; background: #B 0 BFC 2; color: #444} #container {text-align: left; margin: 0 auto; width: 700 px; background: #fff url(header-base. jpg) repeat-y; } h 1 {background: #D 36832; color: #fff; margin: 0; padding: 20 px; border-bottom: 5 px solid #387 a 9 b; } #nav {float: left; width: 130 px; display: inline; margin-left: 20 px; padding: 0; } #nav ul {margin: 0; padding: 25 px 0; list-style-type: none; text-align: right; } #nav li {background: url(header-bullet. jpg) no-repeat 95%. 4 em; padding: 0 20 px 5 px 0; } #content {float: left; width: 475 px; margin-left: 45 px; padding: 15 px 0; } #footer {clear: both; background: #387 A 9 B; color: #fff; padding: 5 px 10 px; text-align: right; font-size: 80%} h 2 {margin-top: 0; color: B 23 B 00; font-weight: normal; } a: link {color: #175 B 7 D; text-decoration: none; } a: visited {color: #600; text-decoration: none; } a: hover, a: active {color: #fff; background: #175 b 7 d; }