Hãy thử điều này:
<div>
<div id="div1" style="float:left">
content
</div>
<div id="div2" >
content
</div>
<div>
Hoặc
tham khảo này: How to style Div elements as Tables
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head><title>table using divs</title>
<style type="text/css">
.div-table{display:table; border:1px solid #003399;}
.div-table-caption{display:table-caption; background:#009999;}
.div-table-row{display:table-row;}
.div-table-col{display:table-cell; padding: 5px; border: 1px solid #003399;}
</style>
</head>
<body>
<div class="div-table">
<div class="div-table-caption">This is a caption</div>
<div class="div-table-row">
<div class="div-table-col">1st Column</div>
<div class="div-table-col">2nd Column</div>
</div>
</div>
</body>
</html>
Lưu ý: Để sử dụng các giá trị thuộc tính CSS, bạn cần phải có một trình duyệt web hỗ trợ chúng. Thật không may, mà dịch để một số lượng hạn chế của các trình duyệt web như IE 8, Firefox 3, Opera 9 và vân vân
Nguồn
2011-11-11 04:17:11
Cảm ơn bạn! Overflow: hidden là phép thuật tôi đã mất tích. –
vui lòng giúp đỡ :) – sandeep
Wow, mind-boggling. Ai sẽ nghĩ 'overflow: hidden; 'là câu trả lời. Nếu tôi có thể 1000-up câu trả lời này tôi sẽ;) Cảm ơn! – pixelfreak