0
我試圖確保我完全理解它。假設我想要一個正好是600像素寬和1000像素高的頁面,並將每個頁面分爲3個等間隔列,每個列的邊界爲1像素。然後div應該各自爲998像素高和198像素寬,並且它們應該被定位爲絕對,其中(0,0),(0,200)和(0,400)各自的(頂部,左側)位置,因爲600像素全身對應於0到599的絕對水平像素位置。這3個div將佔據身體的整個寬度。我不必擔心div的邊距或填充的身體,因爲這些值是無關當絕對定位處於活動狀態時。正確?我的HTML邏輯正確的位置/像素/ div/etc?
這裏是我的代碼:
<html>
<head>
<title>div practice</title>
<style type="text/css">
body
{
height: 1000px;
width: 600px;
}
.outercol
{
position: absolute;
width: 198px;
height: 998px;
border: solid 1px black;
}
#co1
{
top: 0px;
left: 0px;
}
#co2
{
top: 0px;
left: 200px;
}
#co3
{
top: 0px;
left: 400px;
}
</style>
</head>
<body>
<div class="outercol" id="co1">
<p>This text is inside column 1</p>
</div>
<div class="outercol" id="co2">
<p>This text is inside column 2</p>
</div>
<div class="outercol" id="co3">
<p>This text is inside column 3</p>
</div>
</body>
</html>
你測試了嗎?什麼對它不起作用? – cimmanon
填充移動您的邊框。 – cubrr