Yuav ua li cas yog tias koj tsis sau doctype html?
Yuav ua li cas yog tias koj tsis sau doctype html?

Video: Yuav ua li cas yog tias koj tsis sau doctype html?

Video: Yuav ua li cas yog tias koj tsis sau doctype html?
Video: Tsis Tau Txaus Koj | Kong Chue (Official Music Video) 2024, Kaum ib hlis
Anonim

Tsis muaj ib Doctype :

Lub browser nkag mus rau hom Quirks thiab sim nrog koj cov cai raws li yog nws tau sau nyob rau hauv lub lig 90's. Qhov no txhais tau tias lawv yuav xyaum ntau kab uas muaj nyob rau hauv lub qub browsers. Lub hom phiaj ntawm DOCTYPE yog qhia rau tus browser seb hom twg HTML koj yog sau ntawv . Nws tsis siv tau rau omit lub DOCTYPE.

Ua raws li qhov no, nws puas tsim nyog sau doctype hauv HTML?

peb yuav tsum ib txwm siv a DOCTYPE rau txhua tus browser raws li Nws qhia qhov browser yuav txhais li cas html thiab css. Cov <! DOCTYPE > kev tshaj tawm yuav tsum yog thawj qhov hauv koj HTML cov ntaub ntawv, ua ntej lub < html > tag.

Ib sab saum toj no, doctype yog dab tsi thiab yuav ua li cas yog tias doctype tsis tshaj tawm hauv daim ntawv? Txawm yog tias DOCTYPE tsis tau tshaj tawm , lub web browser yuav ua rau lub vev xaib thiab sim ua kom pom nws zoo li kuv DOCTYPE yog hom tshaj tawm uas yog siv los qhia cov web browsers dab tsi version ntawm HTML peb siv nyob rau hauv peb lub vev xaib / lub vev xaib.

Khaws qhov no hauv kev xav, dab tsi <! Doctype html txhais li cas?

A doctype lossis hom ntawv tshaj tawm yog ib qho kev qhia uas qhia lub web browser txog cov lus cim uas nyob rau nplooj ntawv tam sim no yog sau. Cov Doctype yog tsis yog ib qho khoom lossis tag, nws cia tus browser paub txog cov version ntawm lossis tus qauv ntawm HTML los yog lwm yam lus markup uas yog siv rau hauv cov ntaub ntawv.

Vim li cas peb thiaj siv doctype hauv HTML?

DOCTYPE > tag yog siv qhia rau tus browser txog qhov version ntawm HTML siv hauv daim ntawv. Nws yog hu ua tus hom ntawv tshaj tawm ( DTD ). Technically <! DOCTYPE > tsis yog ib tag /element, nws tsuas yog cov lus qhia rau browser txog qhov hom ntawv.

Pom zoo: