मुझे समझ में नहीं आता कि फ्लोट दाएं या बाएं वाला एक div रिश्तेदार स्थिति के साथ एक div से ऊपर नहीं है या आखिरी बार घोषित होने पर पृष्ठभूमि रंग के साथ परिभाषित किया गया है। यहाँएक div फ्लोट पर रिश्तेदार स्थिति के साथ एक div
<html>
<body>
<div class="container">
Main container <br/><br/>
<div class="header">This is the header</div>
<div class="text-right">Right text</div>
<div class="footer">This is the footer</div>
</div>
</body>
और सीएसएस है:
यहाँ एचटीएमएल है
.header {
background-color:blue;
border: solid;
color: white;
border-color:black;
height: 100px;
}
.text-right{
float: right;
border: solid;
background-color: green;
}
.container{
padding: 10px;
border: solid;
}
.footer{
padding-top: 50px;
border: solid;
background-color: yellow;
position: relative;
}
मुझे पता है कि मैं एक .clear उपयोग कर सकते हैं: इस समस्या को ठीक करने के लिए दोनों नियम लेकिन मेरा मुख्य बिंदु यह है: जब मैं पृष्ठभूमि-रंग या स्थिति या दोनों .footer नियम में सेट करता हूं, तो फ्लोट div पाद लेख के नीचे होता है?
बहुत बहुत धन्यवाद!
यहां एक सामान्य JSFiddle उदाहरण है जो एक ही समस्या दिखाता है: http://jsfiddle.net/5Kefa/5/ – KajMagnus