Autor |
Nachricht |
EssEff
Threadersteller
Dabei seit: 07.11.2005
Ort: offenbach
Alter: 53
Geschlecht:
|
Verfasst Di 10.10.2006 11:08
Titel float und elternelement |
|
|
hallo,
bei mir hakts grad etwas. dies soll eine vorlage werden, die auf verschiedene dinge angewendet werden, somit auch unterschiedliche inhalte haben werden.
folgender code:
html:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Unbenanntes Dokument</title>
<style type="text/css">
<!--
#content {
background-color:silver;
width:300px;
height:auto;
}
#links {
float:left;
}
#rechts {
float:left;
}
-->
</style>
</head>
<body>
<div id="content">
<p id="links">hallo leute</p>
<p id="rechts">wie gehts?</p>
</div>
</body>
</html>
der "content" soll sich automatisch in der höhe verändern, je mehr "links und rechts" drinne sind (art tabelle). allerdings liegen die float-elemente außerhalb des "content". wenn ich nicht floate, liegen sie innnerhalb und der "content" richtet sich danach.
besten dank!
|
|
|
|
|
m
Moderator
Dabei seit: 18.11.2004
Ort: -
Alter: -
Geschlecht:
|
Verfasst Di 10.10.2006 11:27
Titel
|
|
|
Code: | <div id="content">
<p id="links">hallo leute</p>
<p id="rechts">wie gehts?</p>
<br style="clear:both;" />
</div> |
Falls ich dich richtig verstanden habe..
|
|
|
|
|
Anzeige
|
|
|
EssEff
Threadersteller
Dabei seit: 07.11.2005
Ort: offenbach
Alter: 53
Geschlecht:
|
Verfasst Di 10.10.2006 11:34
Titel
|
|
|
besten dank!! das klappt jetzt!!
|
|
|
|
|
sahnemuh
Dabei seit: 19.06.2003
Ort: /dev/null
Alter: 42
Geschlecht:
|
Verfasst Di 10.10.2006 11:35
Titel
|
|
|
zu dem thema ist folgendes auch ganz interessant / brauchbar:
http://www.positioniseverything.net/easyclearing.html
mal davon ausgegangen du vernachlässigst den ie 5 mac sähe dein markup dann so aus :
Code: |
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Unbenanntes Dokument</title>
<style type="text/css">
<!--
#content {
background-color:silver;
width:300px;
height:auto;
}
#links {
float:left;
}
#rechts {
float:left;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {display: inline-block;}
-->
</style>
</head>
<body>
<div id="content" class="clearfix">
<p id="links">hallo leute</p>
<p id="rechts">wie gehts?</p>
</div>
</body>
</html>
|
Zuletzt bearbeitet von sahnemuh am Di 10.10.2006 11:38, insgesamt 2-mal bearbeitet
|
|
|
|
|
Feile
Dabei seit: 02.08.2005
Ort: Senden
Alter: -
Geschlecht:
|
Verfasst Di 10.10.2006 11:56
Titel
|
|
|
seit wann kann der ie 5.5 / 6 auf windows die pseudo-klassen after/before etc?
War mir nicht bekannt.
|
|
|
|
|
sahnemuh
Dabei seit: 19.06.2003
Ort: /dev/null
Alter: 42
Geschlecht:
|
Verfasst Di 10.10.2006 13:22
Titel
|
|
|
hättest du den link gelesen, hättest du das hier gefunden:
Zitat: | But what about IE?
Since IE/Win does not support the :after pseudoclass, we must rely on its "auto-clearing" effect, but that behavior only happens when the clearing element has a dimension applied to it. In many cases it's undesirable to use either a height or a width, but happily the Holly hack comes to our rescue. This hack lets IE/Win and only IE/Win see a simple 1% height for the container. How does that help? Well, IE/Win happens to have another spec violation that causes all boxes to expand and enclose all content, regardless of any stated dimensions that may be smaller! So that 1% height will just be expanded to whatever value is needed to contain the float, and the mere fact of applying a dimension triggers the "auto-float-enclosing" behavior. Cool eh? |
|
|
|
|
|
|
|
|
Ähnliche Themen |
[css] div(float: right) vertikal im elternelement zentrieren
Hilfe: div float / width:100% - CSS float Box Model
[WP] Elternelement
css: margin beeinflusst elternelement
Text verkleinern, sobald breiter als Elternelement
2 Divs nebeneinander die zum Elternelement relativ sind?
|
|