Daim duab tsis yog tso ncaj qha rau hauv cov ntawv nyeem. Tus browser tau qhia nws lub npe thiab qhia qhov twg thiab yuav ua li cas tso nws ntawm qhov screen. Txhawm rau ua qhov no, siv ib qho HTML img tag. Nws qhia qhov chaw ntawm cov duab nraaj ntawm nplooj ntawv web.
Yog tias muaj ntau tus cwj pwm xaiv tau rau cov cim, ces img tag yuav tsum muaj tsawg kawg yog ib qho parameter - qhov chaw nyob ntawm daim duab. Tus cwj pwm no hu ua src:
- - qhov no yuav tso tawm cov tshis-j.webp" />
- - nrog qhov ntsuas no ntawm img tag, browser yuav thauj cov duab tso rau hauv Is Taws Nem ntawm qhov chaw megasellmag.ru.
Txoj kev sib tw
Txhawm rau tso cov duab ntawm nplooj ntawv siv HTML, img tag yog siv, cov cwj pwm uas yog lub luag haujlwm rau muab cov duab tso rau ntawm nplooj ntawv thiab qhov xwm txheej ntawm nws cov ntawv qhwv.
Los ntawm lub neej ntawd, tus browser tso cov duab rau hauv nruab nrab ntawm lub vijtsam, thiab cov ntawv tsis qhwv ib ncig ntawm nws. Daim ntawv img yuav tso cai rau koj los qhia koj qhov kev tsis pom zoo nrog tus browser siv tus cwj pwm alignment (alignment).
- daim duab yuav muab tso rau ntawm ntug sab laug ntawm nplooj ntawv, thiab cov ntawv yuav mus ncig nws ntawm sab xis.
Tus cwj pwm ntawm cov ntawv nyeem yuav zoo sib xws yog tias daim duab tso rau sab xis (align=right), hauv nruab nrab (align=middle), sab saum toj (align=top), hauv qab(align=bottom) thiab nruab nrab (center).
Kev teeb tsa thiab qhov ntau thiab tsawg
Txhawm rau tiv thaiv cov ntawv los ntawm nkag mus rau hauv cov duab, img lossis tau txais cov yam ntxwv tshwj xeeb -hspace (kab rov tav / kab rov tav kab) thiab vspace (ntsug / ntsug kab), uas txiav txim siab npaum li cas ntawm cov ntawv sau los ntawm cov npoo ntawm cov duab hauv pixels.
Daim duab yuav tsis mloog lus tsuas yog txav deb ntawm cov ntawv los ntawm tus nqi teev tseg, tab sis kuj txav deb ntawm ntug ntawm nplooj ntawv, yog li nws yog qhov zoo tshaj kom tsis txhob muaj cov ntawv loj.
Qhov ntev geometric ntawm cov duab yog qhov tseem ceeb heev, uas tsis yog qhov xav tau xwb, tab sis qee zaum tsuas yog tsim nyog los qhia meej rau qhov tseeb ntawm cov duab. Rau qhov no, tus cwj pwm dav (dav) thiab qhov siab (qhov siab) yog siv, tus nqi uas yog teem rau hauv pixels lossis feem pua.
Yog tias koj qhia tsuas yog qhov dav xwb, qhov siab yuav raug xaiv nrog tus thawj proportions. Qhov ntau thiab tsawg feem pua tso cai rau koj tso cov duab nyob rau sab xis ntawm nplooj ntawv, tsis hais qhov loj ntawm qhov browser qhov rai, thiab qhov xav tau no feem ntau tshwm sim.
Lwm txoj kev xaiv
Tus cwj pwm ciam teb npog cov duab hauv ib lub thav duab ntawm cov tuab tuab, uas tus browser tsis ua los ntawm lub neej ntawd.
Tus ciam teb kuj tuaj yeem muaj qhov tsis muaj txiaj ntsig zoo li xoom-dav (ciam teb='0'), tab sis qhov ntawd yog kom txog thaum cov duab dhau los ua qhov txuas, thaum browser cia li ncig nws nrog xiav ciam teb yam tsis tau tos cov lus qhia.
Qee cov neeg siv siab ntev, npau taws nrog qhov ceev hauv internet tsawg, tsuas yog lov tes taw cov duab ntawm cov duab. Rau cov xwm txheej zoo li no, lub alt parameter yog muab, uas tso cai rau koj nkag muslwm cov ntawv uas tus neeg siv yuav pom nyob rau hauv lub thawv uas cov duab yog maj mam mus load.
Yog tias koj tsis nyiam qhov muaj peev xwm ntawm alt parameter, img tag tuaj yeem muab cov yam ntxwv longdesc, tus nqi uas yog qhov URL ntawm daim ntawv nrog cov lus piav qhia ntxiv.
Cov yam ntxwv siv thiab ismap qhia rau tus browser tias daim duab yuav yog daim duab uas cov hyperlinks yog cov chaw sib cais (txuas daim ntawv qhia), tsuas yog usemap parameter txiav txim siab daim ntawv qhia kev taw qhia ntawm lub server, thiab ismap - daim ntawv qhia ntawm tus neeg siv khoom sab.
Kev piav qhia ntawm qhov txuas 1 hauv daim duab hauv qab no:
Tus cwj pwm lowsrc qhia tus browser kom thawj zaug rub tawm ib daim qauv (lossis lwm txoj hauv kev) ntawm cov duab qub uas muaj qhov zoo dua thiab, yog li ntawd, ib qho "sib dua". Qhov kev ua kom yuam kev no yog muab rau hauv cov ntaub ntawv uas tsis tshua muaj Internet ceev rau tus neeg siv. Cov duab qub, thaum upload, hloov qhov "fake".
Qhov tsis tshua siv galleryimg tus cwj pwm ntawm img tag invokes cov duab tswj vaj huam sib luag (thaum hovered), tso cai rau koj qhib lub neej ntawd Kuv Cov Duab nplaub tshev thiab luam tawm, txuag lossis email daim duab. Koj tuaj yeem lov tes taw lub vaj huam sib luag los ntawm kev teeb tsa lub galleryimg parameter rau tsis muaj / cuav, thiab ua kom nws los ntawm kev teeb tsa yog / tseeb.
Nyob rau hauv HTML5 tshiab specification, ib tug xov tooj ntawm cov cim npe muaj ib co tsis deprecated. Piv txwv li, lowsrc, ciam teb, longdesc, thiab lub npe cwj pwm ntawm img tau so haujlwm.