การแก้ปัญหากรณี div หลักไม่ขยายตามความสูงของ div ย่อย ใน Firefox

Bookmark and Share

CSS Code

<style type="text/css">
div.cDiv{
	margin:auto;
	width:75%;
	background-color:#EAEAEA;
	border:1px solid #999999;
}
div.lDiv{
	float:left;
	width:200px;
	background-color:#FFCC99;
	border:1px solid #999999;	
}
</style>

HTML Code

<div class="cDiv">
test test
test test

<div class="lDiv">
test<br />

test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />

</div>

</div>

ปัญหาจะเกิดกับ Firefox การแก้ปัญหา โดยเพิ่ม

<div style="clear:both"></div>
ไว้ก่อนปิด div หลัก

HTML Code

<div class="cDiv">
test test
test test

<div class="lDiv">
test<br />

test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />

</div>
<!--เพิ่มบรรทัดข้างล่างนี้ก่อนปิด div หลัก-->
<div style="clear:both"></div>
</div>




บทความในหมวดที่่น่าสนใจ อื่นๆ CSS Learning

02 Apr 10 สร้าง layout 3 คอลัมน์ column ให้ สูงเท่ากัน ด้วย เทคนิค css อ่าน 1337 25 Sep 08 การทำให้หน้าเว็บของเราสามารถดูได้อย่างเดียว อ่าน 1245 11 May 10 การจัดข้อความ text direction rotation หมุนข้อความ แนวตั้ง ด้วย css ในตาราง อ่าน 1101 19 Mar 10 ทบทวน คุณสมบัติ สี color และ พื้นหลัง background property ของ CSS อ่าน 1087 14 Feb 09 การระบุการใช้งาน css ค่าใดค่าหนึ่ง อย่างเฉพาะเจาะจง (specificity) อ่าน 1002
จำนวนผู้เยี่ยมชม 157925 คน 2010 © Copyright ninenik.com. All rights reserved.