Daniel: HILFE:...Dringend. ABstand innerhalb eines Rahmens

Hallo zusammmen!

Ich verzweifle gerade an folgender Aufgabe:
Folgender Code liegt mir vor:
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>Sonnet---Solution for 6.3</title>

<style type="text/css">

body {
background-color:
black
}

h1,h2{
 background-color: Black;
 margin-top: 20px;
 margin-left: 20px;
 font-family: Geneva, Arial, Helvetica, san-serif;
 font-size: 20px;
 font-style: normal;
 color: #FFFFFF;

margin-bottom: 20px;
 position: static;

left: 30px;
 clip: rect( );
 border: 2px outset #FFFFFF;
 width: 400px;
 background : Blue;
 border-bottom : 2px outset White;
 border-bottom-width : 2px;
 border-color : White White White White;
 border-left : 2px outset White;
 border-left-width : 2px;
 border-right : 2px;
}

h2{
font-weight: bold;
font-size: 20pt;
color: white;
font-family: helvetica;

}

h1 {
color: white;

}

p { font-weight: bold}

h1 {
font-weight: bold;
font-size: 14pt;
font-family: times;
}

</style>

</head>

<sonnet author="Shakespeare">

<h2>Sonnet---Solution for 6.3</h2>
<h1 class="Sonnet">

<p>Look in thy glass and tell the face thou viewest</p>
  <p>Now is the time that face should form another;</p>
  <p>Whose fresh repair if now thou not renewest,</p>
  <p>Thou dost beguile the world, unbless some mother.</p>
  <p>For where is she so fair whose unear'd womb</p>
  <p>Disdains the tillage of thy husbandry?</p>
  <p>Or who is he so fond will be the tomb,</p>
  <p>Of his self-love to stop posterity?</p>
  <p>Thou art thy mother's glass and she in thee</p>
  <p>Calls back the lovely April of her prime;</p>
  <p>So thou through windows of thine age shalt see,</p>
  <p>Despite of wrinkles this thy golden time.</p>
  <p>But if thou live, remember'd not to be,</p>
  <p>Die single and thine image dies with thee.</p>
</h1>

</html>
<body>

Nun habe ich das Problem, dass es nicht möglich ist, zwischen dem Rahmen der Tabelle und dem <h2> einen Abstand von 20px einzufügen.
Das gleiche Problem habe ich bei dem Abstand zur linken Seite der Tabelle (Rahmens).
Weiß jemand zufällig den genauen Syntax, den ich hier jetzt einfügen muss?

Danke im Voraus.
Gruß Daniel

  1. Hi,

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
    "http://www.w3.org/TR/REC-html40/strict.dtd">
    <html>
    <head>
    <title>Sonnet---Solution for 6.3</title>
    <style type="text/css">
    </style>
    </head>
    <sonnet author="Shakespeare">

    Das Element sonnet existiert im angegebenen Dokumenttyp nicht.

    <h2>Sonnet---Solution for 6.3</h2>
    <h1 class="Sonnet">

    Üblicherweise kommt die Überschrift der höchsten Ordnung (h1) vor einer untergeordneteren (h2)

    <p>Look in thy glass and tell the face thou viewest</p>
      <p>Now is the time that face should form another;</p>
      <p>...</p>
    </h1>

    Hm, seltsame Konstruktion, den gesamten Text als Überschrift der höchsten Ordnung anzugeben
    Falsch ist es sowieso, da p ein block-Element ist und h1 nur inline-Elemente enthalten darf.

    </html>
    <body>

    Nun habe ich das Problem, dass es nicht möglich ist, zwischen dem Rahmen der Tabelle und dem <h2> einen Abstand von 20px einzufügen.

    fatal error: table not found.

    Das gleiche Problem habe ich bei dem Abstand zur linken Seite der Tabelle (Rahmens).

    fatal error: table not found.

    cu,
    Andreas

    --
    Der Optimist: Das Glas  ist halbvoll.  - Der Pessimist: Das Glas ist halbleer. - Der Ingenieur: Das Glas ist doppelt so groß wie nötig.
    http://mud-guard.de/? http://www.andreas-waechter.de/ http://www.helpers.de/
    1. Mist, da ist von dem Quelltext etwas verloren gegangen. So sollte er aussehen:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
      "http://www.w3.org/TR/REC-html40/strict.dtd">
      <html>
      <head>
      <title>Sonnet---Solution for 6.3</title>
      <style type="text/css">

      body {
      background-color:
      black;
      margin-left: 30px;
      }

      h2{
      font-weight: bold;
      font-size: 20pt;
      color: white;
      font-family: helvetica;
      }

      h1
      {
      color: white;
      font-weight: bold;
      font-size: 14pt;
      font-family: times new roman;
      }

      table
      {
      border: 2px White solid;
      padding : 20px;

      background-color: blue;
      width: 400px;
      margin-bottom: 20px;
      clip:     rect(   );
      margin-top: 20px
      }

      </style>
      </head>
       <body>
      <table>
        <tr>
          <td><h2>Sonnet---Solution for 6.3</h2>
            <h1 class="Sonnet">
              Look in thy glass and tell the face thou viewest<br>
              Now is the time that face should form another;<br>
              Whose fresh repair if now thou not renewest,<br>
              Thou dost beguile the world, unbless some mother.<br>
              For where is she so fair whose unear'd womb<br>
              Disdains the tillage of thy husbandry?<br>
              Or who is he so fond will be the tomb,<br>
              Of his self-love to stop posterity?<br>
              Thou art thy mother's glass and she in thee<br>
              Calls back the lovely April of her prime;<br>
              So thou through windows of thine age shalt see,<br>
              Despite of wrinkles this thy golden time.<br>
              But if thou live, remember'd not to be,<br>
              Die single and thine image! dies with thee.<p></p>
            </h1>
       </td>
        </tr>
      </table>
       </body>
      </html>

      Wie kann man den nun ziwschen dem oberen Rahmen der Tabelle und dem <h2> einen Abstand von 20 px erzeugen?

      CU
      Daniel

      1. <table>
          <tr>
            <td><h2>Sonnet---Solution for 6.3</h2>

        [1] ->»»       <h1 class="Sonnet">

        Look in thy glass and tell the face thou viewest<br>
                Now is the time that face should form another;<br>
                Whose fresh repair if now thou not renewest,<br>
                Thou dost beguile the world, unbless some mother.<br>
                For where is she so fair whose unear'd womb<br>
                Disdains the tillage of thy husbandry?<br>
                Or who is he so fond will be the tomb,<br>
                Of his self-love to stop posterity?<br>
                Thou art thy mother's glass and she in thee<br>
                Calls back the lovely April of her prime;<br>
                So thou through windows of thine age shalt see,<br>
                Despite of wrinkles this thy golden time.<br>
                But if thou live, remember'd not to be,<br>
                Die single and thine image! dies with thee.<p></p>
              </h1>
         </td>
          </tr>
        </table>

        [2] ->»» Wie kann man den nun ziwschen dem oberen Rahmen der Tabelle und dem <h2> einen Abstand von 20 px erzeugen?

        [1] Nimm hier besser ein <p>-Element, <h1> ist eine Überschrift erster Ordnung, sollte somit auch logischerweise vor <h2> stehen!

        [2] a) füge noch eine Tabrow mit einem Leer-Gif mit der Höhe 20px ein, oder b) (besser) definiere halt für Deine <h2> einen margin-top von 20px

        Gruss AndreD

      2. Prost!

        table
        {
        border: 2px White solid;
        padding : 20px;

        Hier fehlt die schließende "}", da kanns doch nicht gehen :) Habe den Quelltext mal _mit_ der Klammer getestet, und es funktioniert.

        mfg Torsten

        --
        Opinions are like assholes: everybody has one.
        ss:| zu:| ls:# fo:| de:[ va:| ch:? n4:& rl:? br:& js:| ie:% fl:( mo:}
  2. Hallo Daniel,

    zum Einen sehe ich in deinem Quelltext keine Tabelle, und zum Anderen kenne ich die Marke <sonnet> nicht!

    Außenabstände definiert man bei CSS mit dem Attribut "margin" und Innenabstände mit "padding".

    Gruß
    Helmut Weber

    --
    -------------------------------------------
    Mode ist eine Variable, Stil eine Konstante
  3. hi,
    also entweder musst du das janze inne tabelle packen und dann die td (oder meinetwegen auch h2) auf margin-left: 20px setzen.
    das wäre eine möglichkeit. die andere wäre einfach ein noBreakSpace ( ) vor dem jeweiligen wort (satz) zu setzen.
    ohne tabelle bringt dir ein margin-left nichts, da es sich nur an andere elemente richtet. d.h. es muss link daneben ein element sein, auf den die margin-left angabe bezogen werden kann.

    mfg
    christopher

    ps: falls du einen anderen weg findest belehre mich eines besseren ;)

    1. Beziehst Du das jetzt auf den Quellcode, den ich unten nochmal gepostet habe?
      Das ist alles in einer Tabelle...!?