XHTMLforum

XHTMLforum (http://xhtmlforum.de/index.php)
-   CSS (http://xhtmlforum.de/forumdisplay.php?f=73)
-   -   CSS/PHP Seite in die Mitte setzten?? (http://xhtmlforum.de/showthread.php?t=66554)

Dima 06.01.2012 12:59

CSS/PHP Seite in die Mitte setzten??
 
Liste der Anhänge anzeigen (Anzahl: 1)
Ich hab da ein kleines problem:

http://xhtmlforum.de/attachment.php?...1&d=1325851019

CSS Code:

Code:

@charset "UTF-8";

html, body {
background-image: url(../img/bg.png);
background-repeat: repeat;
text-align: left;
width: 850px;
font-family: Arial;
font-size: 11pt;
}

#navi-top {
background-image: url(../img/navi-top.png);
background-repeat: no-repeat;
text-align: center;
width: 120px;
height: 30px;
font-family: Curier New;
margin-top: -3px;
}

#navi-content {
padding: 0 6px 0 6px;
background-image: url(../img/navi-content.png);
background-repeat: repeat-y;
width: 120px;
height: auto;
}

#navi-bottom {
background-image: url(../img/navi-bottom.png);
background-repeat: no-repeat;
width: 120px;
height: 5px;
}

#content-top {
background-image: url(../img/content-top.png);
background-repeat: no-repeat;
text-align: center;
width: 730px;
height: 30px;
font-family: Curier New;
margin-top: -3px;
}

#content {
padding: 0 6px 0 6px;
background-image: url(../img/content.png);
background-repeat: repeat-y;
width: 730px;
height: auto;
}

#content-bottom {
background-image: url(../img/content-bottom.png);
background-repeat: no-repeat;
width: 730px;
height: 5px;
}

PHP Code:

PHP-Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Layout 1</title>
  <link href="css/style.css" type="text/css" rel="stylesheet" media="all" />
  </head>
  <body>
    <div id="navi-top">Navigation</div>
    <div id="navi-content"><?php chdir("menu/"); include("navi.html"); ?></div>
    <div id="navi-bottom"></div><br />
    <div id="content-top">Content Head</div>
    <div id="content">Content Text</div>
    <div id="content-bottom"></div>
  </body>
</html>

P.S. Ist noch nicht fertig^^

ThomasE 06.01.2012 13:37

Dem Titel zu folge willst du den Inhalt deiner Seite also zentrieren? Sowas geht z.B. so:

Code:

body{
    margin: 0 auto;
}

Aber mal ehrlich, schreib doch bitte 1-2 Sätze zu deinem Problem. Du willst doch schließlich etwas von uns, da will ich nicht noch raten müssen worum es geht.

Dima 06.01.2012 13:57

Danke^^ Ja ok nächstes mal schreibe ich mehr :D

Jetzt noch das Problem mit der Navigation neben dem Content :/

ThomasE 06.01.2012 15:03

Float: Die Theorie

Dima 06.01.2012 15:43

Verstehe nix :/ wo muss ich im css code die floats hinmachen?

hubspe 06.01.2012 15:52

Zitat:

Zitat von Dima (Beitrag 508613)
Verstehe nix :/

vielleicht ist es hier etwas besser erklärt! ;)

Dima 06.01.2012 16:15

Liste der Anhänge anzeigen (Anzahl: 4)
Jetzt sieht's so aus:

ohne float:
http://xhtmlforum.de/attachment.php?...1&d=1325862655

float bei navi-top:
http://xhtmlforum.de/attachment.php?...1&d=1325862716

float bei navi-content:
http://xhtmlforum.de/attachment.php?...1&d=1325862763

float bei navi-bottom:
http://xhtmlforum.de/attachment.php?...1&d=1325862801

Wo muss ich das float bzw. die floats hinmachen? css code [ohne floats]:
Code:

@charset "UTF-8";

html, body {
background-image: url(../img/bg.png);
background-repeat: repeat;
text-align: left;
width: 850px;
font-family: Arial;
font-size: 11pt;
margin: 0 auto;
}

A { text-decoration: none; font-weight: bold; color: #6d6d6d; }

#header {
background-image: url(../img/header.png);
background-repeat: no-repeat;
width: 850px;
height: 100px;
}

#navi-top {
background-image: url(../img/navi-top.png);
background-repeat: no-repeat;
text-align: center;
width: 120px;
height: 33px;
font-weight: bold;
color: white;
}

#navi-content {
padding: 0 6px 0 6px;
background-image: url(../img/navi-content.png);
background-repeat: repeat-y;
width: 120px;
height: auto;
}

#navi-bottom {
background-image: url(../img/navi-bottom.png);
background-repeat: no-repeat;
width: 120px;
height: 7px;
}

#content-top {
background-image: url(../img/content-top.png);
background-repeat: no-repeat;
text-align: center;
width: 730px;
height: 33px;
font-weight: bold;
color: white;
margin-left: 10px;
}

#content {
padding: 0 6px 0 6px;
background-image: url(../img/content.png);
background-repeat: repeat-y;
width: 730px;
height: auto;
margin-left: 10px;
}

#content-bottom {
background-image: url(../img/content-bottom.png);
background-repeat: no-repeat;
width: 730px;
height: 7px;
margin-left: 10px;
}


hubspe 06.01.2012 16:54

du wirst nicht umhin kommen das mit dem Float zu verstehen.
Links dazu hast du bekommen.

Foren bieten vor allem Hilfe zur Selbsthilfe!!

Üblicherweise bekommen html und body keine Breite und werden nicht horizontal zentriert.
Das übernimmt ein Element was alle anderen Elemente umschließt (div#wrapper z.B.).
pt ist eine absolute Einheit für den Printbereich und fürs Web ungeeignet.

Little Boxes ist zum Erarbeiten der Grundlagen bestens geeignet. ;)

Dima 06.01.2012 16:57

Ja eigentlich bin ich ganz schön weit mit der Seite aber das mit den floats versteh ich nicht hab alles versucht :(

gato 06.01.2012 17:02

Floats kann man nicht innerhalb von 2 Stunden verstehen. Dazu ist ein ruhiger und unhektischer (d.h. kein "ich wills jetzt endlich schaffen") Lernvorgang nötig. Der erfordert vielleicht mal ne Nacht drüber zu schlafen, aber es ist nicht wirklich kompliziert, wenn man sich etwas Zeit dafür nimmt.

Zwei Quellen wurden dir bereits dazu genannt, float und clear werden aber im Web bis zum erbrechen beschrieben.


Alle Zeitangaben in WEZ +2. Es ist jetzt 22:42 Uhr.

Powered by vBulletin® Version 3.8.11 (Deutsch)
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

© Dirk H. 2003 - 2023