Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> HTML
HTML
  1. วิธีล้างข้อมูลฟอร์ม (Reset Form) ใน HTML

    ใช้ <input type=reset> สร้างปุ่มล้างข้อมูลฟอร์ม คืนค่า input ทุกตัวเป็นค่าเริ่มต้น (initial value) รูปแบบพื้นฐาน <form> <input type=text name=username value=default> <input type=reset value=Reset Form> </form> ตัวอย่างเต็ม <!DOCTYPE html> <html> <bo

  2. วิธีสร้าง Bibliography (รายการอ้างอิง) ใน HTML

    Bibliography คือรายการหนังสือ/แหล่งอ้างอิงที่ใช้ในงานเขียน สร้างได้ด้วย <ol> (ลำดับ) หรือ <ul> ร่วมกับ <cite> สำหรับชื่อผลงาน โครงสร้างแนะนำ <ol class=bibliography> <li> <cite>Book Title</cite> by Author Name. Publisher, Year. </li> <li&g

  3. วิธีจัดสไตล์ HTML ด้วยแท็ก div (Block Container)

    แท็ก <div> (division) เป็น block-level container ใช้จัดกลุ่ม element หลายตัวเป็น section เพื่อ apply style หรือ layout ร่วมกัน คุณสมบัติ Block element - ขึ้นบรรทัดใหม่ กว้างเต็ม container ไม่มี semantic meaning (ใช้ <section>, <article>, <aside>, <nav>, <main&g

  4. วิธีจัดสไตล์ HTML ด้วยแท็ก span (Inline Styling)

    แท็ก <span> เป็น inline container ใช้จัดกลุ่มและ apply style ให้ส่วนหนึ่งของข้อความ (inline-level) ไม่สร้างบรรทัดใหม่ ความแตกต่าง span vs div spandiv Inline elementBlock element ไม่ขึ้นบรรทัดใหม่ขึ้นบรรทัดใหม่ วางใน block element ได้ไม่ควรวางใน inline element ใช้

  5. วิธีใช้ CSS Class Selector ใน HTML

    CSS Class Selector ใช้เลือก element ที่มี class=classname เพื่อกำหนด style ให้กลุ่ม element พร้อมกัน รูปแบบพื้นฐาน .classname { property: value; } ตัวอย่าง: Class แบบง่าย <!DOCTYPE html> <html> <head> <style> .highlight { background: #ffff00; color: #000; } </sty

  6. วิธีสร้าง Floating Layout ใน HTML/CSS

    Floating Layout ใช้ CSS float property จัด layout แบบหลายคอลัมน์ (Multi-column) เป็นเทคนิคเก่าแต่ยังใช้ได้ สำหรับ layout เรียบง่าย หลักการทำงาน float: left - ลอยไปซ้าย เนื้อหาต่อไปจะหุ้มรอบ float: right - ลอยไปขวา clear: both - หยุดการหุ้มรอบ (clearfix) โครงสร้างคลาสสิก (Sidebar + Content)

  7. วิธีสร้าง Flexbox Layout ใน HTML/CSS

    Flexbox (Flexible Box Layout) เป็น CSS layout mode สำหรับจัดเรียง item ใน container แนวหนึ่ง (1D) ทำให้ responsive และจัดการพื้นที่ได้ยืดหยุ่น ไม่ต้องใช้ float/positioning ซับซ้อน หลักการพื้นฐาน Flex Container - element ที่มี display: flex หรือ inline-flex Flex Items - ลูกโดยตรงของ flex contai

  8. แท็ก Meta ต่างๆ สำหรับกำหนดข้อมูลเมตา (Metadata) ใน HTML

    แท็ก <meta> ใช้กำหนด metadata (ข้อมูลเกี่ยวกับข้อมูล) ของหน้าเว็บ วางใน <head> ไม่มีเนื้อหาแสดงผล แต่งใจต่อ SEO, Social sharing, Mobile viewport Meta Tags ที่สำคัญ 1. Character Encoding (จำเป็น) <meta charset=UTF-8> 2. Viewport (Responsive - จำเป็น) <meta name=viewport conten

  9. วิธีสร้างเอกสาร HTML ที่ถูกต้องโดยไม่มีแท็ก html, body, head

    HTML parser ของ browser ทนทาน (forgiving) มาก สามารถ render หน้าเว็บได้แม้ข้าม <html>, <head>, <body> ไป โดยต้องมี <!DOCTYPE html> อยู่เสมอ ตัวอย่าง Minimal Valid HTML5 <!DOCTYPE html> <title>Title of the page</title> <h1>This is heading 1</h1>

  10. วิธีใช้ Inline CSS (Inline Style) ใน HTML

    Inline CSS คือการเขียน CSS โดยตรงใน attribute style ของ element ใช้สำหรับ style เฉพาะ element นั้นๆ เท่านั้น รูปแบบ <h1 style=color: red; font-size: 24px; text-align: center;>Heading</h1> ตัวอย่าง <!DOCTYPE html> <html> <head> <title>HTML Inline CSS</title&

  11. วิธีใช้ Internal CSS (Internal Style Sheet) ใน HTML

    Internal CSS คือการเขียน CSS ไว้ในแท็ก <style> ภายใน <head> ของหน้า HTML ใช้สำหรับ style ที่ใช้ในหน้านั้นๆ เท่านั้น โครงสร้าง <!DOCTYPE html> <html> <head> <style> /* CSS rules ที่นี่ */ h1 { color: red; } p { font-size: 16px; line-height: 1.6; }

  12. วิธีลิงก์หน้าเว็บด้วย Absolute URL ใน HTML

    Absolute URL ใช้สำหรับลิงก์ไปยังเว็บไซต์ภายนอก (External Links) ต้องระบุโปรโตคอลและ domain เต็ม รูปแบบ Absolute URL https://www.example.com/page.html https://subdomain.example.com/path mailto:user@example.com tel:+66812345678 Attribute ของ <a> tag Attributeคำอธิบาย hrefURL

  13. วิธีลิงก์หน้าเว็บด้วย Relative URL ใน HTML

    Relative URL ใช้สำหรับลิงก์ไปยังหน้าอื่นในเว็บไซต์เดียวกัน ไม่ต้องระบุ domain เต็ม รูปแบบ Relative URL รูปแบบความหมายตัวอย่าง /aboutจาก root ของ domainhttps://example.com/about about.htmlในโฟลเดอร์เดียวกันhttps://example.com/folder/about.html ../about.htmlย้อนกลับ 1 โฟลเดอ

  14. วิธีเปลี่ยนสีลิงก์ (Link Color) ใน HTML

    ใช้ CSS property color เพื่อเปลี่ยนสีของลิงก์ (<a>) ได้ทั้ง inline style และ stylesheet วิธีการ <a href=/about style=color: red;>Red Link</a> <a href=/contact style=color: #0066cc;>Blue Link</a> <a href=/blog style=color: rgb(34, 197, 94);>Green Link</a> ต

  15. วิธีลบเส้นใต้ลิงก์ (Remove Underline) ใน HTML

    ใช้ CSS property text-decoration: none เพื่อลบเส้นใต้ของลิงก์ (<a>) ได้ทั้ง inline style และ stylesheet วิธีการ <a href=/about style=text-decoration: none;>Link without underline</a> ตัวอย่างเต็ม <!DOCTYPE html> <html> <head> <title>HTML Text Decoration&

  16. วิธีเปลี่ยนเป้าหมายการเปิดลิงก์ (Target Attribute) ใน HTML

    ใช้ attribute target ในแท็ก <a> เพื่อควบคุมว่าลิงก์จะเปิดที่ไหน ค่าของ target attribute ค่าคำอธิบาย _blankเปิดในแท็บ/หน้าต่างใหม่ (มากที่สุด) _selfเปิดในแท็บ/เฟรมปัจจุบัน (ค่าเริ่มต้น) _parentเปิดในเฟรมพาเรนท์ (ถ้าอยู่ใน iframe) _topเปิดในหน้าต่างบนสุด (ทำลาย fra

  17. วิธีใช้รูปภาพเป็นลิงก์ (Image Link) ใน HTML

    การทำให้รูปภาพเป็นลิงก์ ทำได้โดยการห่อแท็ก <img> ไว้ภายในแท็ก <a> โครงสร้างพื้นฐาน <a href=https://example.com> <img src=image.jpg alt=คำอธิบายรูป width=200 height=100> </a> ตัวอย่าง <!DOCTYPE html> <html> <head> <title>HTML Image as link&l

  18. วิธีสร้าง Bookmark Link (Anchor Link) ใน HTML

    Bookmark Link (หรือ Anchor Link) ใช้สำหรับลิงก์ไปยังส่วนเฉพาะในหน้าเว็บเดียวกัน หรือหน้าอื่น ใช้งานได้ด้วย id attribute (HTML5) แทน name attribute ที่ deprecated แล้ว วิธีการ (HTML5 Standard) กำหนด id ให้ element เป้าหมาย: <h2 id=section1>Section 1</h2> สร้างลิงก์ไปยัง id นั้น: <

Total 2078 -คอมพิวเตอร์  FirstPage PreviousPage NextPage LastPage CurrentPage:95/104  20-คอมพิวเตอร์/Page Goto:1 89 90 91 92 93 94 95 96 97 98 99 100 101