die Höhe des Hauptdiv an den Inhalt der Divs im Hauptdiv anpassen

aherzog

Erfahrenes Mitglied
Hallo miteinander.

Bin gerade dabei bei meiner neuen Website den letzten Schliff in der Darstellung zu geben.
Dabei bin ich auf ein Problem gestossen das ich nicht weiss wie lösen.

Ich habe ein Hauptdiv (page) das sozusagen der Hintergrund der ganzen Seite darstellen soll.
Innerhalb dieses Divs gibt es 1 Div (fvinhalt) das etwa kleiner ist als das Hauptdiv um einen Rand zu simulieren. In diesem Div gibt es 1 Div (titel) das eine fixe länge hat und 1 Div (inhalt) bei dem sich die Länge dem Inhalt anpasst.
Nun will sich das Hauptdiv einfach nicht mit dem Inhalt (die Divs) anpassen.
Ich habe einiges ausprobiert und bin nun mit meinem Wissen am Ende.

Könnt ihr mir weiterhelfen:

Hier etwas Code

CSS:
Code:
body {
	background-color: #039;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 200px;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 13px;
}

#page {
	background-color: #3399FF;
	position: absolute;
	width: 1000px;
	height: 105%;
	left: 51%;
	top: 5px;
	margin-left: -500px;
}

#fvinfo {
	position: absolute;
	background-color: White;
	-webkit-border-radius: 8px;
	-moz-border-radius: 8px;
	border-radius: 8px;
	-webkit-box-shadow: #666 0px 2px 3px;
	-moz-box-shadow: #666 0px 2px 3px;
	box-shadow: #666 0px 2px 3px;
	behavior: url(css3pie/PIE.htc);
	width: 980px;
	height: auto;
	top: 260px;
	left: 10px;
}

.titel {
	color: #006;
	font-size:20px;
	font-weight:bold;
	margin-left: 20px;
	margin-top: 13px;
	width: 940px;
	height: 50px;
}

.inhalt {
	margin-left: 20px;
	margin-top: 10px;
	width: 940px;
	text-align: justify;
}

HTML
HTML:
<div id="page"><img src="../images/titelbild.png" width="1000" height="250" />
    <div id=menu>
        MENÜINHALT
    </div>
    <div id=fvinfo>
    	<div class=titel>
		Inhalt_Titel
	</div>
   	<div class=inhalt>
		Inhalt
	</div>
    </div>
</div>
</div>

Das Div fvinfo passt sich dem Inhalt an.

Was muss ich nun machen das sich das Div page auch an den Inhalt anpasst ?

Vielen Dank für eure Tips.
Gruss Andreas
 
was meinst du mit dem "sich dem Inhalt anpassen"?

änder mal position auf relative und mach den top weg.?
hilft dir das?
Code:
#fvinfo {
    position: relative;
    background-color: White;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
    -webkit-box-shadow: #666 0px 2px 3px;
    -moz-box-shadow: #666 0px 2px 3px;
    box-shadow: #666 0px 2px 3px;
    behavior: url(css3pie/PIE.htc);
    width: 980px;
    height: auto;

    left: 10px;
}

Gruß!
 
Zuletzt bearbeitet:
Danke crazy_chicken

musste noch das div page beabeiten, aber dank deiner Hilfe / Tips hats nun perfekt funktioniert.
Super !
Danke..

Andreas
 

Neue Beiträge

Zurück