วิธีทำ

ฮาวทูโฮม

เมนู

ไอคอนบาร์ ไอคอนเมนู หีบเพลง แท็บ แท็บแนวตั้ง ส่วนหัวของแท็บ แท็บเต็มหน้า วางเมาส์เหนือแท็บ การนำทางยอดนิยม ตอบสนอง Topnav แถบนำทางพร้อมไอคอน ค้นหาเมนู แถบค้นหา แถบด้านข้างคงที่ การนำทางหน้า แถบด้านข้างที่ตอบสนอง การนำทางแบบเต็มหน้าจอ เมนูออฟแคนวาส เลื่อนปุ่ม Sidenav แถบด้านข้างพร้อมไอคอน เมนูเลื่อนแนวนอน เมนูแนวตั้ง การนำทางด้านล่าง การนำทางด้านล่างที่ตอบสนอง ลิงค์นำทางด้านล่าง ลิงค์เมนูชิดขวา ลิงค์เมนูตรงกลาง ลิงค์เมนูความกว้างเท่ากัน เมนูคงที่ แถบเลื่อนลงบน Scroll ซ่อนแถบนำทางบน Scroll ย่อแถบนำทางบน Scroll แถบนำทางติดหนึบ แถบนำทางบนรูปภาพ วางเมาส์เหนือรายการแบบเลื่อนลง คลิกเมนูแบบเลื่อนลง Cascading Dropdown ดรอปดาวน์ใน Topnav เมนูแบบเลื่อนลงใน Sidenav ตอบสนอง Navbar ดรอปดาวน์ เมนูการนำทางย่อย Dropup เมนูเมก้า เมนูมือถือ เมนูผ้าม่าน ยุบแถบด้านข้าง แผงข้างที่ยุบ การแบ่งหน้า เกล็ดขนมปัง กลุ่มปุ่ม กลุ่มปุ่มแนวตั้ง Sticky Social Bar การนำทางยา ส่วนหัวที่ตอบสนอง

รูปภาพ

สไลด์โชว์ แกลเลอรี่ภาพสไลด์ รูปภาพโมดอล ไลท์บ็อกซ์ ตารางภาพที่ตอบสนอง ตารางรูปภาพ แท็บแกลลอรี่ ภาพซ้อนทับจาง สไลด์ภาพซ้อนทับ ซูมภาพซ้อนทับ ชื่อภาพซ้อนทับ ไอคอนภาพซ้อนทับ เอฟเฟกต์ภาพ ภาพขาวดำ ข้อความรูปภาพ บล็อกข้อความรูปภาพ ข้อความรูปภาพโปร่งใส ภาพเต็มหน้า แบบฟอร์มบนรูปภาพ ภาพฮีโร่ ภาพพื้นหลังเบลอ เปลี่ยน Bg บน Scroll ภาพเคียงข้างกัน รูปภาพโค้งมน รูปภาพอวาตาร์ รูปภาพที่ตอบสนอง เซ็นเตอร์ อิมเมจ รูปขนาดย่อ ชายแดนรอบรูปภาพ พบกับทีม ภาพติดหนึบ พลิกภาพ เขย่าภาพ Portfolio Gallery ผลงานที่มีการกรอง ซูมภาพ แว่นขยายภาพ ตัวเลื่อนเปรียบเทียบรูปภาพ Favicon

ปุ่ม

ปุ่มแจ้งเตือน ปุ่มเค้าร่าง ปุ่มแยก ปุ่มเคลื่อนไหว ปุ่มซีดจาง ปุ่มบนรูปภาพ ปุ่มโซเชียลมีเดีย อ่านเพิ่มเติม อ่านน้อยลง กำลังโหลดปุ่ม ดาวน์โหลดปุ่ม ปุ่มยา ปุ่มแจ้งเตือน ปุ่มไอคอน ปุ่มถัดไป/ก่อนหน้า ปุ่มเพิ่มเติมในการนำทาง บล็อกปุ่ม ปุ่มข้อความ ปุ่มกลม เลื่อนไปที่ปุ่มด้านบน

แบบฟอร์ม

แบบฟอร์มเข้าสู่ระบบ แบบฟอร์มลงทะเบียน แบบฟอร์มการชำระเงิน แบบฟอร์มการติดต่อ แบบฟอร์มเข้าสู่ระบบโซเชียล แบบฟอร์มลงทะเบียน แบบฟอร์มที่มีไอคอน จดหมายข่าว แบบฟอร์มซ้อน แบบฟอร์มตอบสนอง แบบฟอร์มป๊อปอัป แบบฟอร์มอินไลน์ ล้างช่องป้อนข้อมูล ซ่อนลูกศรตัวเลข คัดลอกข้อความไปยังคลิปบอร์ด ค้นหาเคลื่อนไหว ปุ่มค้นหา ค้นหาแบบเต็มหน้าจอ ช่องป้อนข้อมูลใน Navbar แบบฟอร์มเข้าสู่ระบบใน Navbar กำหนดเอง ช่องทำเครื่องหมาย/วิทยุ เลือกเอง สวิตช์สลับ เลือกช่องทำเครื่องหมาย ตรวจจับ Caps Lock ปุ่มทริกเกอร์บน Enter การตรวจสอบรหัสผ่าน สลับการเปิดเผยรหัสผ่าน แบบฟอร์มหลายขั้นตอน เติมข้อความอัตโนมัติ ปิดการเติมข้อความอัตโนมัติ ปิดการตรวจตัวสะกด ปุ่มอัพโหลดไฟล์ การตรวจสอบความถูกต้องของอินพุตที่ว่างเปล่า

ตัวกรอง

รายการตัวกรอง ตารางตัวกรอง องค์ประกอบตัวกรอง กรองรายการแบบเลื่อนลง เรียงรายการ ตารางการสะกด

โต๊ะ

โต๊ะลายม้าลาย โต๊ะกลาง ตารางเต็มความกว้าง โต๊ะข้างเคียง ตารางตอบสนอง ตารางเปรียบเทียบ

มากกว่า

วิดีโอแบบเต็มหน้าจอ กล่องโมดอล ลบ Modal เส้นเวลา ตัวบ่งชี้การเลื่อน แถบความคืบหน้า แถบทักษะ ตัวเลื่อนช่วง เคล็ดลับเครื่องมือ แสดงองค์ประกอบ Hover ป๊อปอัพ พับได้ ปฏิทิน HTML รวม รายการสิ่งที่ต้องทำ รถตัก ระดับดาว คะแนนของผู้ใช้ เอฟเฟกต์ภาพซ้อนทับ ติดต่อชิป การ์ด พลิกการ์ด การ์ดโปรไฟล์ บัตรผลิตภัณฑ์ การแจ้งเตือน โทรออก หมายเหตุ ป้าย แวดวง สไตล์ HR คูปอง รายการกลุ่ม รายการที่ไม่มีสัญลักษณ์แสดงหัวข้อย่อย ข้อความตอบสนอง ข้อความคัตเอาท์ ข้อความเรืองแสง แก้ไขส่วนท้าย องค์ประกอบเหนียว ความสูงเท่ากัน Clearfix ลอยตัวตอบสนอง สแน็คบาร์ หน้าต่างเต็มหน้าจอ วาดเลื่อน เลื่อนเรียบ เลื่อน Bg ไล่ระดับ ติดหัว ย่อส่วนหัวบน Scroll ตารางราคา พารัลแลกซ์ อัตราส่วนภาพ Iframes ที่ตอบสนอง สลับชอบ/ไม่ชอบ สลับซ่อน/แสดง สลับโหมดมืด สลับข้อความ สลับคลาส เพิ่มคลาส ลบคลาส คลาสที่ใช้งาน วิวต้นไม้ ลบทรัพย์สิน การตรวจจับออฟไลน์ ค้นหาองค์ประกอบที่ซ่อนอยู่ เปลี่ยนเส้นทางหน้าเว็บ ซูมโฮเวอร์ พลิกกล่อง ตั้งศูนย์ในแนวตั้ง ปุ่มกลางใน DIV การเปลี่ยนแปลงเมื่อวางเมาส์เหนือ ลูกศร รูปร่าง ลิ้งค์ดาวน์โหลด องค์ประกอบความสูงเต็ม หน้าต่างเบราว์เซอร์ แถบเลื่อนแบบกำหนดเอง ซ่อนแถบเลื่อน แสดง/บังคับแถบเลื่อน ดูอุปกรณ์ เส้นขอบที่แก้ไขได้ ตัวยึดสี สีการเลือกข้อความ สีกระสุน เส้นแนวตั้ง วงเวียน ไอคอนเคลื่อนไหว นาฬิกาจับเวลาถอยหลัง เครื่องพิมพ์ดีด เร็วๆ นี้ เพจ ข้อความแชท หน้าต่างแชทแบบป๊อปอัป หน้าจอแยก ข้อความรับรอง ส่วนเคาน์เตอร์ สไลด์โชว์คำคม รายการที่ปิดได้ เบรกพอยต์อุปกรณ์ทั่วไป องค์ประกอบ HTML ที่ลากได้ JS Media Queries ปากกาเน้นข้อความ JS Animations JS String Length JS การยกกำลัง JS พารามิเตอร์เริ่มต้น รับ URL ปัจจุบัน รับขนาดหน้าจอปัจจุบัน รับองค์ประกอบ Iframe

เว็บไซต์

สร้างเว็บไซต์ฟรี ทำเว็บไซต์ สร้างเว็บไซต์แบบคงที่ สร้างเว็บไซต์ (W3.CSS) สร้างเว็บไซต์ (BS3) สร้างเว็บไซต์ (BS4) สร้างเว็บไซต์ (BS5) สร้างและดูเว็บไซต์ สร้างเว็บไซต์ลิงค์ทรี สร้างผลงาน สร้างเรซูเม่ ทำเว็บไซต์ร้านอาหาร ทำเว็บไซต์ธุรกิจ ทำเว็บบุ๊ก เว็บไซต์ศูนย์ ส่วนติดต่อ เกี่ยวกับเพจ หัวโต ตัวอย่างเว็บไซต์

กริด

เค้าโครง 2 คอลัมน์ เค้าโครง 3 คอลัมน์ เค้าโครง 4 คอลัมน์ ขยายกริด แสดงรายการมุมมองกริด เค้าโครงคอลัมน์แบบผสม การ์ดคอลัมน์ เค้าโครงซิกแซก เค้าโครงบล็อก

Google

Google Charts Google Fonts การจับคู่แบบอักษรของ Google Google ตั้งค่า Analytics

ตัวแปลงสัญญาณ

แปลงน้ำหนัก แปลงอุณหภูมิ แปลงความยาว แปลงความเร็ว

บล็อก

รับงานนักพัฒนา มาเป็น Front-End Dev

How TO - สร้างเว็บไซต์


เรียนรู้วิธีสร้างเว็บไซต์ตอบสนองที่รวดเร็วและยอดเยี่ยม ซึ่งจะทำงานได้กับทุกอุปกรณ์ พีซี แล็ปท็อป แท็บเล็ต และโทรศัพท์


สร้างเว็บไซต์ด้วย CSS Framework

เคยได้ยินเกี่ยวกับW3Schools Spacesไหม? ที่นี่คุณสามารถสร้างเว็บไซต์ของคุณตั้งแต่เริ่มต้นหรือใช้เทมเพลตและโฮสต์ได้ฟรี

เริ่มต้นฟรี ❯

* ไม่ต้องใช้บัตรเครดิต


"ร่างเค้าโครง"

It is always wise to draw a layout draft of the page design before building a website.

Having a "Layout Draft" will make it a lot easier to create a web site:

Navigation bar

Slideshow

The Band

Description of the band

Description of the band

Description of the band


Article

Article

Article


Footer


Doctype, Meta Tags, and CSS

The doctype should define the page as an HTML5 document:

<!DOCTYPE html>

A meta tag should define the character set to be UTF-8:

<meta charset="UTF-8">

A viewport meta tag should make the web site work on all devices and screen resolutions:

<meta name="viewport" content="width=device-width, initial-scale=1">

W3.CSS should take care of all our styling needs and all device and browser differences:

<link rel="stylesheet" href="https://www.w3schools.com/w3css/3/w3.css">

To learn more about styling with W3.CSS, please visit our W3.CSS Tutorial.

Our first empty web page will look much like this:

<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/3/w3.css">
<body>

<!-- Content will go here -->

</body>
</html>

Note: If you want to create a website from scratch, without the help of a CSS framework, read our How To Make a Website Tutorial.


Creating Page Content

Inside the <body> element of our web site we will use our "Layout Picture" and create:

  • A navigation bar
  • A slide show
  • A header
  • Some sections and articles
  • A footer

Semantic Elements

HTML5 introduced several new semantic elements. Semantic elements are important to use because they define the structure of web pages and helps screen readers and search engines to read the page correctly.

These are some of the most common semantic HTML elements:

The <section> element can be used to define a part of a website with related content.

The <article> element can be used to define an individual piece of content.

The <header> element can be used to define a header (in a document, a section, or an article).

The <footer> element can be used to define a footer (in a document, a section, or an article).

The <nav> element can be used to define a container of navigation links.

In this tutorial we will use semantic elements.

However, it is up to you if you want to use <div> elements instead.


The Navigation Bar

On our "Layout Draft" we have a "Navigation bar".

<!-- Navigation -->
<nav class="w3-bar w3-black">
  <a href="#home" class="w3-button w3-bar-item">Home</a>
  <a href="#band" class="w3-button w3-bar-item">Band</a>
  <a href="#tour" class="w3-button w3-bar-item">Tour</a>
  <a href="#contact" class="w3-button w3-bar-item">Contact</a>
</nav>

We can use a <nav> or <div> element as a container for the navigation links.

The w3-bar class is a container for navigation links.

The w3-black class defines the color of the navigation bar.

The w3-bar-item and w3-button class styles the navigation links inside the bar.



Slide Show

On the "Layout Draft" we have a "Slide show".

For the slide show we can use a <section> or <div> element as a picture container:

<!-- Slide Show -->
<section>
  <img class="mySlides" src="img_la.jpg" style="width:100%">
  <img class="mySlides" src="img_ny.jpg" style="width:100%">
  <img class="mySlides" src="img_chicago.jpg" style="width:100%">
</section>

We need to add a little JavaScript to change the images every 3 seconds:

// Automatic Slideshow - change image every 3 seconds
var myIndex = 0;
carousel();

function carousel() {
  var i;
  var x = document.getElementsByClassName("mySlides");
  for (i = 0; i < x.length; i++) {
    x[i].style.display = "none";
  }
  myIndex++;
  if (myIndex > x.length) {myIndex = 1}
  x[myIndex-1].style.display = "block";
  setTimeout(carousel, 3000);
}


Sections and Articles

Looking at the "Layout Draft" we can see that the next step is to create articles.

First we will create a <section> or <div> element containing band information:

<section class="w3-container w3-center" style="max-width:600px">
  <h2 class="w3-wide">THE BAND</h2>
  <p class="w3-opacity"><i>We love music</i></p>
</section>

The w3-container class takes care of standard padding.

The w3-center class centers the content.

The w3-wide class provides a wider heading.

The w3-opacity class provides text transparency.

The max-width style sets a maximum with of the band description section.

Then we will add a paragraph describing the band:

<section class="w3-container w3-content w3-center" style="max-width:600px">
<p class="w3-justify">
We have created a fictional band website. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</section>

The w3-justify class justifies the text's right and left margins.

Then create a <section> or <div> with an <article> or <div> about each band-member:

<section class="w3-row-padding w3-center w3-light-grey">
  <article class="w3-third">
    <p>John</p>
    <img src="img_bandmember.jpg" alt="Random Name" style="width:100%">
  </article>
  <article class="w3-third">
    <p>Paul</p>
    <img src="img_bandmember.jpg" alt="Random Name" style="width:100%">
  </article>
  <article class="w3-third">
    <p>Ringo</p>
    <img src="img_bandmember.jpg" alt="Random Name" style="width:100%">
  </article>
</section>


Footer

Finally we will use a <footer> or <div> to create a footer:

<!-- Footer -->
<footer class="w3-container w3-padding-64 w3-center w3-black w3-xlarge">
  <a href="#"><i class="fa fa-facebook-official"></i></a>
  <a href="#"><i class="fa fa-pinterest-p"></i></a>
  <a href="#"><i class="fa fa-twitter"></i></a>
  <a href="#"><i class="fa fa-flickr"></i></a>
  <a href="#"><i class="fa fa-linkedin"></i></a>
  <p class="w3-medium">
    Powered by <a href="https://www.w3schools.com/w3css/default.asp" target="_blank">w3.css</a>
  </p>
</footer>

The fa fa classes are Font Awesome Icon classes.

To use these classes you must link to a Font Awesome library:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">

To learn more about using icons, please visit our Icons Tutorial.