Devdit
 

ติด YouTube HTML ด้วย iframe และ embed

615

ติด YouTube HTML ด้วย iframe และ embed บทความนี้สอนวิธีการนำวีดีโอของ YouTube มาติด หรือแสดงที่หน้าเว็บไซต์ โดยใช้แท็ก HTML คือ iframe และ embed พร้อมแสดงผลลัพธ์ออกสู่หน้าจอ สามารถเขียนคำสั่งได้ดังนี้

 

ตัวอย่าง ลิงก์วีดีโอ YouTube

https://www.youtube.com/embed/xxxxxxxx

 

ตัวอย่าง ติด YouTube HTML ด้วย iframe และ embed

<iframe width="560" height="315" src="https://www.youtube.com/embed/xxxxxxxx" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<embed width="560" height="315" src="https://www.youtube.com/embed/xxxxxxxx" title="YouTube video player"></embed>

คำอธิบาย

ติด YouTube HTML จากตัวอย่างแนะนำ 2 แท็กคือ iframe และ embed ใช้สำหรับติด หรือแสดงวีดีโอ YouTube บนหน้าเว็บไซต์ กำหนดขนาดความกว้างที่ width และความสูงที่ height และลิงก์วีดีโอ YouTube ที่ src

แก้ไข 1 ปีที่แล้ว
ชอบ
ลิ้งก์
แชร์
Devdit มีช่อง YouTube แล้ว
เราสร้างวิดีโอเกี่ยวกับเทคโนโลยี ทำตามง่ายๆ