Phau ntawv Beginner's Guide to HTML5 Placeholder Links

HTML5 Placeholder Links Rau Dab Tsi?

idUp txog HTML5, tus lossis tau ua ib qho attribute: href. Tab sis HTML5 ua txawm tias qhov attribute yeem. Thaum koj sau tus cim lossis tsis muaj tus cwj pwm nws yog hu ua qhov chaw txuas.

Ib qho chaw txuas qhov chaw zoo li qhov no:

Yav Tas Los

Siv Qhov Chaw Tso Chaw Nyob Hauv Kev Loj Hlob

Ze li txhua lub website designer tau tsim qhov chaw sib txuas hauv ib lub sijhawm lossis lwm qhov thaum tsim thiab tsim ib lub vev xaib. Ua ntej HTML5, peb yuav sau:

link text

raws li cov placeholder. Thiab kuv tau xa mockup qhov chaw rau cov neeg muas zaub nrog cov neeg muab cov neeg tsuas yog kom muaj tus neeg nug kom kuv "vim li cas ho tsis ua rau hauv cov ntawv nyeem?"

Qhov teeb meem uas siv lub hashtag (#) raws li qhov chaw txuas yog tias qhov txuas yog clickable, thiab qhov no ua rau tsis meej pem rau koj cov neeg. Thiab, yog hais tias ib tug neeg tsis nco qab hloov kho lawv nrog qhov tseeb URLs, cov kev mus saib tau tshwm tuaj rau hauv qhov chaw nyob vim tias lawv tsis txuas rau txhua yam.

Xwb, koj yuav tsum pib siv cov cim npe tsis muaj cov cwj pwm. Koj tuaj yeem siv cov lus zoo li lwm qhov txuas rau ntawm koj daim ntawv, tab sis lawv yuav tsis raug nias vim lawv tsuas yog cov neeg tso npe.

Siv qhov chaw nyob ntawm cov chaw nyob

Tab sis placeholder links muaj ib qho chaw hauv web tsim rau ntau tshaj li kev loj hlob xwb. Ib qho chaw uas muaj qhov chaw txuas nrog qhov chaw nyob yog nyob rau hauv navigation. Feem ntau, lub website navigation npe muaj qee txoj kev qhia txog cov nplooj ntawv uas koj nyob. Cov no feem ntau hu ua "koj nyob ntawm no".

Feem ntau ntawm cov chaw cia siab rau tus cwj pwm ntawm tus cwj pwm uas xav tau qhov "koj nyob ntawm no", tab sis qee qhov siv tus cwj pwm ntawm chav kawm thiab. Txawm li cas los xij, tus cwj pwm uas koj siv, koj yuav tsum tau ua ib pawg ua hauj lwm rau txhua nplooj ntawv uas muaj lub ntsiab ntawm nws, ntxiv thiab tshem tus cwj pwm los ntawm cov ntsiab lus tseeb.

Muaj ib qhov chaw txuas, koj tuaj yeem sau koj tus navigation tiam sis koj xav tau, thiab tom qab ntawd ces tshem tawm tus cwj pwm href ntawm qhov tsim nyog txuas thaum koj ntxiv qhov kev xa mus rau phab. Kuv muab kuv daim ntawv teev tas nrho raws li lub snippet rau kuv editor, vim li ntawd nws yog ib tsab ceev-muab tshuaj thiab mam li rho tawm qhov href. Koj tuaj yeem tau txais koj qhov CMS los ua qhov qub.

Thiab dhau li ntxiv tshwj xeeb styling (Kuv mam li qhia koj li cas hauv qab) mus rau ib qho chaw placeholder, qhov txuas tsis nias. Yog li ntawd cov neeg muas zaub tsis tau tsis meej pem xav tias lawv yuav tau txais ib yam dab tsi yog lawv nias rau ntawm qhov chaw txuas uas lawv nyob tam sim no.

Styling Placeholder Links

Cov neeg mus rau qhov chaw yog qhov yooj yim rau cov style thiab style txawv ntawm lwm qhov kev sib txuas ntawm koj qhov web page. Tsuas paub tseeb tias yuav tsum ua li cas rau ob qho tib si thiab ib qhov txuas hauv qab. Piv txwv li:

a {color: red; font-weight: bold; ntawv-kho kom zoo nkauj: tsis muaj; } a: link {color: blue; font-weight: qub; ntawv-kho kom zoo nkauj: underline; }

Qhov CSS no yuav ua rau cov neeg tso qhov chaw txuas nrog dub thiab liab, tsis muaj kev kos npe. Thaum mus tsis tu ncua yuav muaj qhov hnyav, xiav thiab kos duab.

Nco ntsoov rov qab ua dua twg yam uas koj tsis xav kom tau nqa los ntawm lub cim. Piv txwv li, kuv teev font-yuag rau bold rau ntawm qhov chaw mus rau qhov chaw, kuv thiaj li tau teem caij mus rau:

font-weight: qub;

rau tus qauv kev sib txuas. Tib yam muaj tseeb nrog cov ntawv-kho kom zoo nkauj, los ntawm kev tshem nws nrog lub selector, nws yuav tau raug tshem tawm rau qhov: qhov txuas ntawm qhov txuas yog tias kuv tsis tau muab nws rov qab.