<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tutorialwelt.de &#187; CSS Pro</title>
	<atom:link href="http://www.tutorialwelt.de/category/css/css-pro/feed" rel="self" type="application/rss+xml" />
	<link>http://www.tutorialwelt.de</link>
	<description>Tutorials aus der IT-Welt</description>
	<lastBuildDate>Sat, 22 May 2010 13:24:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wie man in HTML Tabellen nur den tbody scrollt</title>
		<link>http://www.tutorialwelt.de/312/tabellen-nur-tbody-scrollen.htm</link>
		<comments>http://www.tutorialwelt.de/312/tabellen-nur-tbody-scrollen.htm#comments</comments>
		<pubDate>Sat, 19 Sep 2009 00:34:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Pro]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML-Tutorial]]></category>

		<guid isPermaLink="false">http://www.tutorialwelt.de/?p=312</guid>
		<description><![CDATA[...Ich habe es bereits in meinem letzten Tabellen Tutorial angesprochen: Um in allen Browsern den tbody Bereich scrollen zu können, muß ganz gewaltig getrickst werden. Und damit fangen wir heute an: Zuerst benötigen wir eine Standardtabelle mit einem thead, einem tfoot und einem tbody Bereich...


Related posts:<ol><li><a href='http://www.tutorialwelt.de/259/html-tabellen-teil-4-tbody.htm' rel='bookmark' title='Permanent Link: Tabellen in HTML &#8211; Teil 4 thead, tbody, tfoot'>Tabellen in HTML &#8211; Teil 4 thead, tbody, tfoot</a> <small>...Heute möchte ich Euch erklären, wie Ihr größere Tabellen in...</small></li>
<li><a href='http://www.tutorialwelt.de/377/html-tabellen-tbody-scrollen-und-korrekt-ausdrucken-teil-2.htm' rel='bookmark' title='Permanent Link: HTML Tabellen tbody scrollen und korrekt ausdrucken Teil 2'>HTML Tabellen tbody scrollen und korrekt ausdrucken Teil 2</a> <small>In unserem vorherigen Tutorial hatten wir zuletzt mehrere Probleme: Opera...</small></li>
<li><a href='http://www.tutorialwelt.de/319/html-tabellen-tbody-scrollen-und-korrekt-ausdrucken-teil-1.htm' rel='bookmark' title='Permanent Link: HTML Tabellen tbody scrollen und korrekt ausdrucken Teil 1'>HTML Tabellen tbody scrollen und korrekt ausdrucken Teil 1</a> <small>Im letzten Tutorial habe ich Euch gezeigt, wie man bei...</small></li>
</ol>

Ähnliche Artikel bereitgestellt von <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<h1 style="font-size:16px;">HTML Tabellen nur tbody scrollen</h1>
<p>Ich habe es bereits in meinem letzten Tabellen Tutorial angesprochen: Um in allen Browsern den tbody Bereich scrollen zu können, muß ganz gewaltig getrickst werden. Und damit fangen wir heute an: Zuerst benötigen wir eine Standardtabelle mit einem thead, einem tfoot und einem tbody Bereich:</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;body&gt;
  &lt;table&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td&gt;Zelle 1&lt;/td&gt;
     &lt;td&gt;Zelle 2&lt;/td&gt;
     &lt;td&gt;Zelle 3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Wir müssen, um tbody zu scrollen eine weitere Tabelle in den tbody Bereich einfügen. Dazu ist der erste Schritt, die drei td Zellen zu einer einzigen zusammenzufassen:</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;body&gt;
  &lt;table&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td <span style="font-size: 16px;font-weight: bold; color: #ff0000;">colspan="3"</span>&gt;Zelle 1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Mit colspan=&#8221;3&#8243; teilen wir der Tabelle mit, daß sie die drei Zellen zu einer einzigen zusammenfügen soll.</p>
<p>Nun machen wir weiter: Wir weisen der Tabelle eine id zu, damit wir die Tabelle per CSS formatieren können. Nennen wir die Tabelle outertab (für die äußere Tabelle):</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;body&gt;
  &lt;table <span style="font-size: 16px;font-weight: bold; color: #ff0000;">id="outertab"</span>&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td colspan="3"&gt;Zelle 1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Nun möchte ich per CSS festlegen, daß die Tabelle einen Rahmen hat, der 1 Pixel breit und schwarz ist.<br />
Die Tabelle soll 20 Pixel von oben und links versetzt werden (ich möchte sie etwas freistehend haben), 70% breit und 400 Pixel hoch:</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 <strong>&lt;head&gt;
 <span style="font-size: 16px;font-weight: bold; color: #ff0000;">&lt;style type="text/css"&gt;
  #outertab {
      border: 1px #000000 solid;
      position: absolute;
      top: 20px;
      left: 20px;
      width:70%;
      height: 400px;
      }
 &lt;/style&gt;</span></strong>
 &lt;/head&gt;
 &lt;body&gt;
  &lt;table id="outertab"&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td colspan="3"&gt;Zelle 1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Nun müssen wir in den tbody Bereich einen Div Container einfügen. Diesem div Container geben ir eine id innerdiv:</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;head&gt;
 &lt;style type="text/css"&gt;
  #outertab {
      border: 1px #000000 solid;
      position: absolute;
      top: 20px;
      left: 20px;
      width:70%;
      height: 400px;
      }
 &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;table id="outertab"&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td colspan="3"&gt;
       <span style="font-size: 16px;font-weight: bold; color: #ff0000;">&lt;div id="innerdiv"&gt;
       &lt;/div&gt;</span>
     &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Der div Container soll 330 Pixel hoch (etwa 70px kleiner als die Tabelle), 100% breit und als overflow den Wert auto haben:</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;head&gt;
 &lt;style type="text/css"&gt;
  #outertab {
      border: 1px #000000 solid;
      position: absolute;
      top: 20px;
      left: 20px;
      width:70%;
      height: 400px;
      }
  <span style="font-size: 16px;font-weight: bold; color: #ff0000;">#innerdiv {
      width: 100%;
      height: 330px;
      overflow:auto;
      }</span>
 &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;table id="outertab"&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td colspan="3"&gt;
       &lt;div id="innerdiv"&gt;
       &lt;/div&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Nun möchte ich in den Div-Container eine zweite Tabelle setzen. Dieser Tabelle möchte ich die id innertab zuweisen. Diese Tabelle sollte nun zu Testzwecken schon mehrere tr Zeilen beinhalten. Wir wollen schließlich die Tabelle auch scrollen:</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;head&gt;
 &lt;style type="text/css"&gt;
  #outertab {
      border: 1px #000000 solid;
      position: absolute;
      top: 20px;
      left: 20px;
      width:70%;
      height: 400px;
      }
  #innerdiv {
      width: 100%;
      height: 330px;
      overflow:auto;
      }
 &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;table id="outertab"&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td colspan="3"&gt;
       &lt;div id="innerdiv"&gt;
          <span style="font-size: 16px;font-weight: bold; color: #ff0000;">&lt;table id="innertab"&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
          &lt;/table&gt;</span>
       &lt;/div&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Diese innere Tabelle sollte eine Höhe von 330 Pixel und eine Breite von 100% haben. Der Rand sollte auf 0px gesetzt werden (ist aber kein muss):</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;head&gt;
 &lt;style type="text/css"&gt;
  #outertab {
      border: 1px #000000 solid;
      position: absolute;
      top: 20px;
      left: 20px;
      width:70%;
      height: 400px;
      }
  #innerdiv {
      width: 100%;
      height: 330px;
      overflow:auto;
      }
  <span style="font-size: 16px;font-weight: bold; color: #ff0000;">#innertab {
      border: 0px;
      width:  100%;
      height: 330px;
      }</span>
 &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;table id="outertab"&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td colspan="3"&gt;
       &lt;div id="innerdiv"&gt;
          <strong>&lt;table id="innertab"&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
          &lt;/table&gt;</strong>
       &lt;/div&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Zu guter letzt noch ein paar Schönheitsmakulaturen: Die Zellen in der innertab Tabelle sollten schon einen Rand haben.</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;head&gt;
 &lt;style type="text/css"&gt;
  #outertab {
      border: 1px #000000 solid;
      position: absolute;
      top: 20px;
      left: 20px;
      width:70%;
      height: 400px;
      }
  #innerdiv {
      width: 100%;
      height: 330px;
      overflow:auto;
      }
  #innertab {
      border: 0px;
      width:  100%;
      height: 330px;
      }
  <span style="font-size: 16px;font-weight: bold; color: #ff0000;">#innertab td{
      border: 1px #000000 solid;
      }</span>
 &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;table id="outertab"&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td colspan="3"&gt;
       &lt;div id="innerdiv"&gt;
          &lt;table id="innertab"&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
          &lt;/table&gt;
       &lt;/div&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Und das rechte heading sollte auf 34% gesetzt werden, da es über dem Scrollbalken sitzt. Hier werden die Zellen um etwa 20 Pixel versetzt. Bei mir sah es besser aus, wenn ich die mittlere Spalte der innertab ebenfalls auf 34% gesetzt habe. Das Endergebnis sähe dann folgendermaßen aus:</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;head&gt;
 &lt;style type="text/css"&gt;
  #outertab {
      border: 1px #000000 solid;
      position: absolute;
      top: 20px;
      left: 20px;
      width:70%;
      height: 400px;
      }
  #innerdiv {
      width: 100%;
      height: 330px;
      overflow:auto;
      }
  #innertab {
      border: 0px;
      width:  100%;
      height: 330px;
      }
  #innertab td{
      border: 1px #000000 solid;
      }
  <span style="font-size: 16px;font-weight: bold; color: #ff0000;">th+th+th {width:34%;}
  td+td {width:34%;}</span>

 &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;table id="outertab"&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Überschrift 1&lt;/th&gt;
     &lt;th&gt;Überschrift 2&lt;/th&gt;
     &lt;th&gt;Überschrift 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tfoot&gt;
    &lt;tr&gt;
     &lt;th&gt;Fußnote 1&lt;/th&gt;
     &lt;th&gt;Fußnote 2&lt;/th&gt;
     &lt;th&gt;Fußnote 3&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/tfoot&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td colspan="3"&gt;
       &lt;div id="innerdiv"&gt;
          &lt;table id="innertab"&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
             &lt;td&gt;Zelle 1&lt;/td&gt;
             &lt;td&gt;Zelle 2&lt;/td&gt;
             &lt;td&gt;Zelle 3&lt;/td&gt;
            &lt;/tr&gt;
          &lt;/table&gt;
       &lt;/div&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/body&gt;
 &lt;/html&gt;</pre>
<p></code></div>
<p>Wer die th+th+th Notation nicht kennt: mit th+th wird das zweite heading angesprochen. Mit th+th+th das Dritte usw.</p>
<p>Nun sieht die Tabelle in allen Browsern gleich aus und der tbody Bereich ist scrollbar. Ihr könnt mit dem Ergebnis ein wenig herumexperimentieren. Ich habe mir viele Lösungswege angesehen, aber dieser ist wirklich der einzige, der in fast allen Browsern das gleiche Ergebnis liefert.</p>
<p>Ihr habt hier allerdings einen Nachteil: Der Drucker spielt hier nicht mit. Normalerweise sollte der Drucker auf jeder neuen Seite den thead und den tfoot Bereich ausdrucken. Um den Drucker ebenfalls zu unterstützen muß nochmals getrickst werden. Aber das zeige ich Euch im nächsten Tabellen Tutorial.</p>


<p>Related posts:<ol><li><a href='http://www.tutorialwelt.de/259/html-tabellen-teil-4-tbody.htm' rel='bookmark' title='Permanent Link: Tabellen in HTML &#8211; Teil 4 thead, tbody, tfoot'>Tabellen in HTML &#8211; Teil 4 thead, tbody, tfoot</a> <small>...Heute möchte ich Euch erklären, wie Ihr größere Tabellen in...</small></li>
<li><a href='http://www.tutorialwelt.de/377/html-tabellen-tbody-scrollen-und-korrekt-ausdrucken-teil-2.htm' rel='bookmark' title='Permanent Link: HTML Tabellen tbody scrollen und korrekt ausdrucken Teil 2'>HTML Tabellen tbody scrollen und korrekt ausdrucken Teil 2</a> <small>In unserem vorherigen Tutorial hatten wir zuletzt mehrere Probleme: Opera...</small></li>
<li><a href='http://www.tutorialwelt.de/319/html-tabellen-tbody-scrollen-und-korrekt-ausdrucken-teil-1.htm' rel='bookmark' title='Permanent Link: HTML Tabellen tbody scrollen und korrekt ausdrucken Teil 1'>HTML Tabellen tbody scrollen und korrekt ausdrucken Teil 1</a> <small>Im letzten Tutorial habe ich Euch gezeigt, wie man bei...</small></li>
</ol></p>
<p>Ähnliche Artikel bereitgestellt von <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.tutorialwelt.de/312/tabellen-nur-tbody-scrollen.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Container mit CSS positionieren</title>
		<link>http://www.tutorialwelt.de/80/mit-css-positionieren.htm</link>
		<comments>http://www.tutorialwelt.de/80/mit-css-positionieren.htm#comments</comments>
		<pubDate>Mon, 17 Aug 2009 02:55:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS Pro]]></category>
		<category><![CDATA[CSS-Tutorial]]></category>
		<category><![CDATA[Position]]></category>
		<category><![CDATA[Position absolute]]></category>
		<category><![CDATA[position relative]]></category>

		<guid isPermaLink="false">http://www.tutorialwelt.de/?p=80</guid>
		<description><![CDATA[Es gibt zwei Möglichkeiten, zu positionieren: absolut und relativ. Positioniert man absolut, dann ist die Positionierung des Objektes ohne konkrete Abhängigkeiten zu dem Rest der Seite.


Related posts:<ol><li><a href='http://www.tutorialwelt.de/36/css-vertikal-zentrieren.htm' rel='bookmark' title='Permanent Link: CSS-Tutorial &#8211; vertikal zentrieren ganz einfach'>CSS-Tutorial &#8211; vertikal zentrieren ganz einfach</a> <small>Oftmals wird die Frage gestellt, wie man vertikal mit CSS...</small></li>
<li><a href='http://www.tutorialwelt.de/48/css-z-index.htm' rel='bookmark' title='Permanent Link: Mit CSS z-index Container in den Vordergrund bringen'>Mit CSS z-index Container in den Vordergrund bringen</a> <small>Heute erkläre ich Ihnen, wie man einen Container ein Image...</small></li>
<li><a href='http://www.tutorialwelt.de/312/tabellen-nur-tbody-scrollen.htm' rel='bookmark' title='Permanent Link: Wie man in HTML Tabellen nur den tbody scrollt'>Wie man in HTML Tabellen nur den tbody scrollt</a> <small>...Ich habe es bereits in meinem letzten Tabellen Tutorial angesprochen:...</small></li>
</ol>

Ähnliche Artikel bereitgestellt von <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<h1 style="font-size:16px;">Container mit CSS positionieren</h1>
<p>Um per CSS div Container, images, links, paragraphen und und und zu positionieren, gibt es verschiedene Möglichkeiten. Eine einfach zu nutzende Möglichkeit ist das Objekt per position zu platzieren.</p>
<p>Es gibt zwei Möglichkeiten, zu positionieren: absolut und relativ.</p>
<p><strong>Positioniert man absolut, dann ist die Positionierung des Objektes ohne konkrete Abhängigkeiten zu dem Rest der Seite.</strong></p>
<p><strong>Positioniert man relativ, dann bestimmt der Content, der sich vor dem Objekt befindet die Position.</strong></p>
<p>Ich möchte Ihnen das Anhand von zwei Beispielen zeigen.</p>
<p>Ich erstelle in einer HTML-Datei einen DIV-Container. Ich gebe ihm die ID divcnt. Der Container soll 500px x 500px groß sein und einen grauen Hintergrund haben.</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
 &lt;head&gt;
  &lt;style type="text/css"&gt;
   @import url("pos.css");
  &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;div id="divcnt"&gt;&lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>
<p></code></div>
<p><small>Beispielcode <strong>pos.css:</strong></small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>#divcnt {
        background: #cccccc;
        width: 500px;
        height: 500px;
}</pre>
<p></code></div>
<p>In den Div Container soll nun ein weiterer Div Container mit einer anderen Farbe gesetzt werden.<br />
Der zweite Container soll 150px vom oberen und 50px vom linken Rand entfernt sein.<br />
Er soll die Maße 50px x 50px besitzen.<br />
Die Hintergrundfarbe soll dunkler sein, als die, des ersten Containers.<br />
Der Container soll divcnt2 heißen.</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code><code></p>
<pre>&lt;html&gt;
 &lt;head&gt;
  &lt;style type="text/css"&gt;
   @import url("pos.css");
  &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;div id="divcnt"&gt;&lt;div id="divcnt2"&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>
<p></code></p>
<p></code></div>
<p><small>Beispielcode CSS:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>#divcnt {
        background: #cccccc;
        width: 500px;
        height: 500px;
}

#divcnt2 {
        background: #444444;
        width: 50px;
        height: 50px;
        position: absolute;
        left: 50px;
        top: 150px;
}</pre>
<p></code></div>
<p>Wenn Sie sich dieses Beispiel ansehen, werden Sie feststellen, daß der zweite Container innerhalb des ersten nach rechts unten versetzt ist. Der Abstand beträgt genau die oben in der CSS festgelegten Maße.</p>
<p>Ersetzen wir nun das absolute mit relative:</p>
<p><small>Beispielcode CSS:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>#divcnt {
        background: #cccccc;
        width: 500px;
        height: 500px;
}

#divcnt2 {
        background: #444444;
        width: 50px;
        height: 50px;
        position: relative;
        left: 50px;
        top: 150px;
}</pre>
<p></code></div>
<p>Sie sehen nun einen kleinen Unterschied zwischen absoluter Positionierung und relativer Positionierung.</p>
<p>Bei der relativen Positionierung sollte der Kasten ein wenig nach rechts unten verrutscht sein.</p>
<p>Das hat folgenden Grund: Der erste Container muss auch positioniert sein, damit die absolute Positionierung des zweiten Containers von dem ersten Container abhängig werden kann.</p>
<p>Was passiert nun, wenn wir den ersten Container auch positionieren? Wir testen dies gemeinsam:</p>
<p><small>Beispielcode CSS:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>#divcnt {
        background: #cccccc;
        width: 500px;
        height: 500px;
        position: absolute;
        left: 100px;
        top: 100px;
}

#divcnt2 {
        background: #444444;
        width: 50px;
        height: 50px;
        position: relative;
        left: 50px;
        top: 150px;
}</pre>
<p></code></div>
<p>Sie können sehen, daß der zweite Container nun mit dem ersten mit gewandert ist. Nun sollte auch die absolute Positionierung des zweiten Containers das gleiche Ergebnis liefern:</p>
<p><small>Beispielcode CSS:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>#divcnt {
        background: #cccccc;
        width: 500px;
        height: 500px;
        position: absolute;
        left: 100px;
        top: 100px;
}

#divcnt2 {
        background: #444444;
        width: 50px;
        height: 50px;
        position: absolute;
        left: 50px;
        top: 150px;
}</pre>
<p></code></div>
<p>Wie Sie gesehen haben sollten, ist der Kasten diesmal tatsächlich an der gleichen Stelle, wie bei der relativen Positionierung. Eine absolute Positionierung eines Objektes setzt voraus, daß alle übergeordneten Container auch positioniert wurden.</p>
<p>Nun zeige ich Ihnen den Unterschied zwischen absoluter und relaitver Positionierung. Wir fügen in der HTML-Datei vor den zweiten Div-Container einen Dummy-Text ein:</p>
<p><small>Beispielcode HTML:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>&lt;html&gt;
&lt;head&gt;
  &lt;style type="text/css"&gt;
   @import url("pos.css");
  &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;div id="divcnt"&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   Dummy-Text&lt;br&gt;
   &lt;div id="divcnt2"&gt;&lt;/div&gt;
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>
<p></code></div>
<p>Folgendes sollte nun passiert sein: Der zweite Container überlagert stellenweise den Dummy-Text.</p>
<p>Um dies zu verhindern müssen wir dem zweiten Div-Container mitteilen, daß er den Abstand nach oben zwar eingehalten werden soll, aber wenn vorher noch Content erscheint, dann soll er den bitte nicht überlagern, sondern einfach nach unten ausweichen. Dazu verwenden wir nun die relative Positionierung:</p>
<p><small>Beispielcode CSS:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px; overflow: auto;"><code></p>
<pre>#divcnt {
        background: #cccccc;
        width: 500px;
        height: 500px;
        position: absolute;
        left: 100px;
        top: 100px;
}

#divcnt2 {
        background: #444444;
        width: 50px;
        height: 50px;
        position: relative;
        left: 50px;
        top: 150px;
}</pre>
<p></code></div>
<p>Nun sieht alles wieder schön sauber aus.</p>
<p>Es gibt noch andere Möglichkeiten Objekte zu positionieren. Ich werde Ihnen alle Alternativen Schritt für Schritt zeigen.</p>


<p>Related posts:<ol><li><a href='http://www.tutorialwelt.de/36/css-vertikal-zentrieren.htm' rel='bookmark' title='Permanent Link: CSS-Tutorial &#8211; vertikal zentrieren ganz einfach'>CSS-Tutorial &#8211; vertikal zentrieren ganz einfach</a> <small>Oftmals wird die Frage gestellt, wie man vertikal mit CSS...</small></li>
<li><a href='http://www.tutorialwelt.de/48/css-z-index.htm' rel='bookmark' title='Permanent Link: Mit CSS z-index Container in den Vordergrund bringen'>Mit CSS z-index Container in den Vordergrund bringen</a> <small>Heute erkläre ich Ihnen, wie man einen Container ein Image...</small></li>
<li><a href='http://www.tutorialwelt.de/312/tabellen-nur-tbody-scrollen.htm' rel='bookmark' title='Permanent Link: Wie man in HTML Tabellen nur den tbody scrollt'>Wie man in HTML Tabellen nur den tbody scrollt</a> <small>...Ich habe es bereits in meinem letzten Tabellen Tutorial angesprochen:...</small></li>
</ol></p>
<p>Ähnliche Artikel bereitgestellt von <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.tutorialwelt.de/80/mit-css-positionieren.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS-Tutorial &#8211; vertikal zentrieren ganz einfach</title>
		<link>http://www.tutorialwelt.de/36/css-vertikal-zentrieren.htm</link>
		<comments>http://www.tutorialwelt.de/36/css-vertikal-zentrieren.htm#comments</comments>
		<pubDate>Wed, 12 Aug 2009 14:06:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS Pro]]></category>
		<category><![CDATA[CSS-Tutorial]]></category>

		<guid isPermaLink="false">http://www.tutorialwelt.de/?p=36</guid>
		<description><![CDATA[Oftmals wird die Frage gestellt, wie man vertikal mit CSS zentrieren kann.

Für die horizontale Zentrierung ist die text-align Methode vorgesehen. Doch was macht man, um etwas vertikal zu zentrieren?


Related posts:<ol><li><a href='http://www.tutorialwelt.de/80/mit-css-positionieren.htm' rel='bookmark' title='Permanent Link: Container mit CSS positionieren'>Container mit CSS positionieren</a> <small>Es gibt zwei Möglichkeiten, zu positionieren: absolut und relativ. Positioniert...</small></li>
</ol>

Ähnliche Artikel bereitgestellt von <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<h1 style="font-size: 15px;">Vertikale und horizontale Zentrierung eines DIV Containers per CSS</h1>
<p>Oftmals wird die Frage gestellt, wie man vertikal mit CSS zentrieren kann.</p>
<p>Für die horizontale Zentrierung ist die text-align Methode vorgesehen. <strong>Doch was macht man, um etwas vertikal zu zentrieren?</strong></p>
<p>Dazu gibt es eine sehr einfache Lösung:</p>
<p>Nehmen wir mal als Beispiel einen Div-Container mit der Breite 500px und der Höhe 100px.</p>
<p>Wir erstellen in einer HTML einen DIV-Container mit der id=&#8221;zentr&#8221; und setzen in der CSS folgende Eigenschaften:</p>
<p><small>Beispielcode:</small></p>
<div style="border-style: inset; border-color: #a39c87 #a39c87 #e0d7b9 #e0d7b9; width: 100%; background-color: #f4f0e2; padding: 10px;"><code>body {<br />
background: #cc0000;<br />
}</p>
<p>#zentr {<br />
width: 500px;<br />
height: 100px;<br />
position: absolute;<br />
top: 50%;<br />
left: 50%;<br />
margin-left: -250px;<br />
margin-top: -50px;<br />
background: #ffffff;<br />
}</p>
<p></code></div>
<p>Das bedeutet: Wir setzen <strong>erst</strong> den Container mit seiner linken oberen Ecke an die Bildmitte und <strong>ziehen dann per Margin die Hälfte der Höhe und die Hälfte der Breite wieder ab.</strong> Und so einfach kann man einen DIV-Container zentrieren.</p>


<p>Related posts:<ol><li><a href='http://www.tutorialwelt.de/80/mit-css-positionieren.htm' rel='bookmark' title='Permanent Link: Container mit CSS positionieren'>Container mit CSS positionieren</a> <small>Es gibt zwei Möglichkeiten, zu positionieren: absolut und relativ. Positioniert...</small></li>
</ol></p>
<p>Ähnliche Artikel bereitgestellt von <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.tutorialwelt.de/36/css-vertikal-zentrieren.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
