Mengintegrasikan iFrame dengan betul - jadi ia akan berfungsi
Dengan iFrame anda boleh mengintegrasikan mana-mana kandungan asing ke dalam laman web anda. Kami akan memberitahu anda di sini bagaimana anda boleh menggunakannya untuk memaparkan imej, video dan banyak lagi menggunakan kod.
Mengintegrasikan iFrame ke dalam laman web
Anda boleh mengintegrasikan kandungan dari pembekal lain ke laman web anda dalam iFrame. Ini boleh, sebagai contoh, seksyen peta dari Peta Google, sepanduk pengiklanan dari Amazon atau video YouTube.
- Kod ini kelihatan seperti ini:
- Setiap entri bermula dengan
- Untuk "src =", masukkan laluan atau URL ke kandungan yang anda mahu paparkan dalam bingkai. Adalah penting untuk meletakkan alamat ini dalam petikan.
- Anda harus sentiasa mengisi atribut "nama" dan "tajuk". Dalam satu tangan, teks ditunjukkan apabila bingkai dimuat, dan di sisi lain, entri menyampaikan kebolehaksesan kandungan dalam talian.
- Untuk tidak menggunakan saiz standard yang tidak sesuai untuk bingkai di tapak web anda, masukkan ketinggian dan lebarnya. Nilai-nilai ini boleh diselaraskan secara individu.
- Masukkan atribut untuk ketinggian dan lebar berhubung dengan laman web dalam peratus atau dalam piksel.
- Sekiranya anda mahu memainkan video tertanam di seluruh skrin, tambahkan atribut "allowfullscreen" pada kod:
- Buka laman web anda dalam editor HTML.
- Letakkan kod yang dibuat dengan cara ini pada kedudukan yang diingini pada halaman HTML anda dan simpan perubahan.
Petua: Benamkan video YouTube melalui iFrame
- Anda juga boleh memanggil iFrame selesai di bawah video YouTube melalui "Kongsi"> "Benamkan".
- Sekiranya anda mengklik "Tunjukkan lebih banyak", anda juga boleh mengubah elemen pemain dalam iFrame.
Seterusnya, baca bagaimana untuk membenamkan video dengan HTML sebagai latar belakang laman web.