เลยาว HTML

เว็บไซต์มักแสดงเนื้อหาด้วยหลายคอลัมน์ (เช่นนิตยสารและหนังสือพิมพ์)。

การตั้งแบบ HTML ด้วยองค์ประกอบ <div>。

หมายเหตุ:<div> องค์ประกอบเพื่อตั้งแบบเพราะสามารถจัดการตำแหน่งได้ง่ายโดย CSS。

นี่คือตัวอย่างที่ใช้สี่ตัวแทน <div> ในการสร้างแบบจัดการแถวละแถว:

ตัวอย่าง

<body>
<div id="header">
<h1>City Gallery</h1>
</div>
<div id="nav">
London<br>
Paris<br>
Tokyo<br>
</div>
<div id="section">
<h1>London</h1>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</div>
<div id="footer">
Copyright codew3c.com
</div>
</body>

ทดลองด้วยตัวเอง

CSS:

<style>
#header {
    background-color:black;
    color:white;
    text-align:center;
    padding:5px;
}
#nav {
    line-height:30px;
    background-color:#eeeeee;
    height:300px;
    width:100px;
    float:left;
    padding:5px; 
}
#section {
    width:350px;
    float:left;
    padding:10px; 
}
#footer {
    background-color:black;
    color:white;
    clear:both;
    text-align:center;
    padding:5px; 
}
</style>

ตัวอย่างการจัดแบบจัดการของเว็บไซต์ที่ใช้ HTML5

เอลิเมนต์นิยามทางศัพท์ของ HTML5 กำหนดส่วนต่างๆ ของเว็บไซต์

องค์ประกอบทางศัพท์ HTML5

header กำหนดฝายหัวของเอกสารหรือส่วนของเอกสาร
nav กำหนดตัวแทนของลิงก์นำทาง
section กำหนดส่วนของเอกสาร
article กำหนดเอกสารที่เป็นเดี่ยวเดาะ
aside กำหนดส่วนที่อยู่นอกเนื้อหา (เช่น Sidebar)
footer กำหนดฝายท้ายของเอกสารหรือส่วนของเอกสาร
details กำหนดรายละเอียดเพิ่มเติม
summary กำหนดหัวข้อของ elements ตัว details

นี่คือตัวอย่างที่ใช้ <header>, <nav>, <section>, และ <footer> ในการสร้างแบบจัดการแถวละแถว:

ตัวอย่าง

<body>
<header>
<h1>City Gallery</h1>
</header>
<nav>
London<br>
Paris<br>
Tokyo<br>
</nav>
<section>
<h1>London</h1>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<footer>
Copyright codew3c.com
</footer>
</body>

ทดลองด้วยตัวเอง

CSS

header {
    background-color:black;
    color:white;
    text-align:center;
    padding:5px; 
}
nav {
    line-height:30px;
    background-color:#eeeeee;
    height:300px;
    width:100px;
    float:left;
    padding:5px; 
}
section {
    width:350px;
    float:left;
    padding:10px; 
}
footer {
    background-color:black;
    color:white;
    clear:both;
    text-align:center;
    padding:5px; 
}

การใช้ตารางในการจัดเรียง HTML

หมายเหตุ:The <table> element is not designed to be a layout tool.

The <table> element is used to display tabular data.

การใช้ <table> อาจให้ผลการจัดเรียง เพราะสามารถตั้งรูปแบบตัวแทนตารางด้วย CSS

ตัวอย่าง

<body>
<table class="lamp">
<tr>
  <th>
    <img src="/images/lamp.jpg" alt="Note" style="height:32px;width:32px">
  </th>
  <td>
    The table element was not designed to be a layout tool.
  </td>
</tr>
</table>
</body>

ทดลองด้วยตัวเอง

CSS

<style>
table.lamp {
    width:100%;
    border:1px solid #d4d4d4;
}
table.lamp th, td {
    padding:10px;
}
table.lamp td {
    width:40px;
}
</style>