Cov txheej txheem:

Yuav Ua Li Cas Ua Lub Website Zoo thiab Yooj Yim Nrog Bootstrap 4: 7 Cov Kauj Ruam
Yuav Ua Li Cas Ua Lub Website Zoo thiab Yooj Yim Nrog Bootstrap 4: 7 Cov Kauj Ruam

Video: Yuav Ua Li Cas Ua Lub Website Zoo thiab Yooj Yim Nrog Bootstrap 4: 7 Cov Kauj Ruam

Video: Yuav Ua Li Cas Ua Lub Website Zoo thiab Yooj Yim Nrog Bootstrap 4: 7 Cov Kauj Ruam
Video: 001 piav txog kev ua animation 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Ua Lub Website Zoo thiab Yooj Yim Nrog Bootstrap 4
Yuav Ua Li Cas Ua Lub Website Zoo thiab Yooj Yim Nrog Bootstrap 4

Lub hom phiaj ntawm Cov Lus Qhia no yog muab rau cov neeg paub nrog lub cajmeem - HTML lossis lwm yam - cov lus qhia yooj yim los ua cov ntaub ntawv online nrog Bootstrap 4. Kuv yuav taug kev koj los ntawm kev teeb tsa thawj zaug ntawm lub vev xaib, yuav tsim ob peb yam ntsiab lus sib txawv li cas, thiab qee qhov teeb meem koj tuaj yeem ntsib.

Cov ntaub ntawv tau tawg mus rau tus lej ntawm cov kauj ruam me me los sim thiab ua kom nws muaj kev tswj hwm ntau dua: HTML thav duab, CSS thav duab, Javascript thav duab, navigation bar, thiab lub vev xaib (nrog cov ntsiab lus thaiv).

Yog tias kuv cov lus piav qhia rau qee yam tseem ua rau koj tsis meej pem, xav tawm lus tawm nrog koj cov lus nug, cov lus qhia, lossis google lub ntsiab lus uas koj tsis meej pem txog. Muaj ntau qhov peev txheej muaj rau kev tsim cov vev xaib thiab Bootstrap.

Nco tseg: Phau ntawv qhia no tsis yog tag nrho thiab tsis siv los hloov pauv los kawm paub yuav ua haujlwm li cas hauv HTML, CSS, lossis Javascript.

Cov Kev Pab Cuam

  • Bootstrap 4
  • jQuery 3.3.1

Yeem Kev Pabcuam

  • FontAwesome
  • Google Fonts
  • highlight.js

Yog tias koj xav hla mus rau qhov piv txwv tag nrho lossis saib ntawm qhov chaw cia khoom:

  • Piv txwv tag nrho
  • Chaw cia khoom

Nco tseg: Kuv yuav siv Sublime hauv cov duab rau kuv cov piv txwv yog tias koj xav ua raws nrog tib cov ntawv sau.

Kauj ruam 1: Teeb tsa

Teeb
Teeb
Teeb
Teeb

Teeb tsa

  1. Tsim daim nplaub tshev qhov chaw uas koj tuaj yeem khaws txhua yam peb tab tom yuav rub tawm. Qhov no yuav yog koj cov npe hauv paus rau cov ntaub ntawv sau cia.
  2. Tsim daim nplaub tshev sab hauv ntawm tus ntawd lub npe "bootstrap"
  3. Tsim lwm daim nplaub tshev hauv koj lub hauv paus cov ntaub ntawv npe uas yog lub npe "jquery"

Portfolio nplaub tshev

| ----- bootstrap | ----- jquery

Bootstrap 4

  1. Mus ntsib lawv lub vev xaib thiab nyem "Download" khawm hauv qab ntu "Compiled CSS thiab JS".
  2. Txuag cov ntaub ntawv.zip hauv koj daim ntawv "Downloads" lossis lwm qhov chaw yooj yim.
  3. Qhib cov ntaub ntawv.zip thiab rho tawm cov ntawv "css" thiab "js" mus rau "bootstrap" nplaub tshev uas koj tau ua yav dhau los.

jQuery

  1. Mus ntsib lawv lub vev xaib thiab rub tawm "kev sib tw, kev txhim kho jQuery 3.3.1"
  2. Txuag cov ntawv ntawd sab hauv ntawm "jquery" nplaub tshev uas koj tau ua yav dhau los.

Tag nrho cov txheej txheem tam sim no tau npaj rau thaum peb pib ua haujlwm ntawm cov ntaub ntawv tiag.

Kauj ruam 2: HTML Ncej (index.html)

HTML Ncej (index.html)
HTML Ncej (index.html)

Koj Lub Npe

Cov thav duab no tsis muaj dab tsi nyuaj dhau, tab sis kuv xav piav qhia lub hom phiaj dav dav ntawm kev teeb tsa.

Bootstrap JS Tom qab jQuery

Zoo li muaj qee qhov kev sib tshooj ntawm Bootstrap's Javascript file thiab jQuery's. Kuv tsis tau sim kom pom qhov kev sib tshooj no dav npaum li cas, tab sis ib qho piv txwv yog qhov ua haujlwm poob qis uas kuv siv hauv kab lus qhia. Yog tias koj ntsaws rau hauv Bootstrap ua ntej, khawm poob qis tsis ua haujlwm.

FontAwesome

Yog tias koj tau ua tiav kev txhim kho lub vev xaib, muaj feem yuav koj paub tias FontAwesome yog dab tsi. Txawm li cas los xij yog tias tsis yog qhov no, nws yog lub cim teeb uas suav nrog cov cuab yeej rau kev hloov kho ntxiv. Nws muaj txiaj ntsig zoo kawg yog tias koj zoo li kuv thiab tsis muaj txuj ci txuj ci kiag li.

hightlight.js

Lub moj khaum no tso cai rau hloov pauv tus lej tseem ceeb ntawm nplooj ntawv web. Koj tuaj yeem ntshuam nws zoo li cov txheej txheem uas kuv siv yog tias koj tsuas yog siv cov lus programming ib txwm, tab sis kuj tseem muaj qhov kev xaiv rub tawm cov txheej txheem ntawm cov lus. Kuv tau xaiv qhov kev xaiv tom kawg vim tias muaj ob peb lub ntsiab lus thiab hom lus ini, tab sis nws yog nyob ntawm koj.

Nco tseg: Ceev faj txog cov chaw uas kuv siv cov lej sib txuas rau cov ntaub ntawv zoo li ob lub cim thiab highlight.js. Tsis tas li, txij li tsuas yog Bootstrap thiab jQuery xav tau, xav tias yuav ntxiv lossis tshem tawm lwm cov txheej txheem. Yog tias koj tshem tawm ib qho, nco ntsoov tshem kab ntawm cov cai uas sib haum tom qab.

Kauj Ruam 3: CSS Ncej (style.css)

CSS Ncej (style.css)
CSS Ncej (style.css)
CSS Ncej (style.css)
CSS Ncej (style.css)

/ * * Vam tias toning cov xim bg kom grey thiab hloov cov font style ua rau lub vev xaib yooj yim dua rau haus */ lub cev {keeb kwm yav dhau: grey; font-family: 'Qhib Sans', sans-serif; }

/*

* Qhov no ua kom ntseeg tau tias nav bar nyob saum txhua yam */ nav {z-index: 9999; }

/*

* Qhov no yuav tsum ua kom cov kab ntawv nyeem tau yooj yim dua */ p {font-size: 18px; margin-top: 5px; margin-hauv qab: 5px; }

/*

* Qhov no ua kom ntseeg tau tias txhua qhov kuv cov lej thaiv tau ua kom raug */ code {text-align: left; }

/*

* Kuv tsis xav kom cov npe muaj cov mos txwv */ li {list-style-type: none; }

/*

* Cov ntawv txuas yog xiav los ntawm lub neej ntawd, thiab kuv xav kom lawv ua kab nrog Bootstrap cov style */ li a, a {xim: dawb; }

/*

* Kuv khi ib chav kawm rau ib qho faib uas muaj cov navbar kom ntseeg tau tias cov ntsiab lus tsis sib tshooj */.navFix {padding-bottom: 70px; }

/*

* Qhov loj me me nthuav dav navbar */.social-media {font-size: 1.3em; }

/*

* Lub ntsiab lus tseem ceeb xim rau qhov txuas txuas yog dawb */.dropdown-menu a: hover {keeb kwm yav dhau xim: #212529; }

/*

* Force divs qhia pdfs rau qee qhov siab */.pdfFill {qhov siab: 45rem; }

/*

* Ntxiv qee qhov sib nrug ntawm cov nyees khawm thiab cov lej thaiv */.codeStyle {padding-top: 30px; }

Kuv suav nrog cov ntsiab lus-raws CSS cov ntsiab lus hauv kab ntawv no los sim thiab txuag koj qee lub sijhawm tom qab. Lawv txhua tus yooj yim heev thiab feem ntau yog kev hloov pauv lub neej zoo uas ua rau sib tham nrog cov ntaub ntawv yooj yim rau cov nyeem.

nav z-index cov

Kuv muaj qhov txwv me me ntawm kev txhim kho lub vev xaib, yog li kuv tsis paub tseeb tias qhov no yog teeb meem tshwm sim thaum siv Bootstrap's navigation bar, tab sis tsis muaj kev qhia ua ntej-rau-rov qab kev qhia tshwj xeeb, qhov bar navigation yuav tshwm nyob hauv lwm cov ntsiab lus zoo li Bootstrap daim npav. Qhov no yog qhov pom tau tshaj plaws nrog kev sib tsoo navbar, tab sis kuv suav nrog qhov ntsuas hloov pauv rau qhov kev nyab xeeb.

chaws kawm tuab si lug

Txij li thaum kuv ib txwm siv Bootstrap's "ua pov thawj-cov ntsiab lus-chaw" thiab "ntawv-chaw" cov chav kawm kom ua raws cov ntsiab lus, Kuv tsis xav kom kuv tus lej los ua qhov qub-raws li qhov xwm txheej. Qhov no tau yooj yim kho los ntawm kev sau dua ib qho kev hloov pauv hloov pauv thiab ua cov cim cim rau sab laug ua ke: qhov no khaws cia tab-spacing hauv cov cai.

navFix ntaub ntawv

Thaum Bootstrap's navigation bar tau nyam mus rau sab saum toj ntawm nplooj ntawv cov ntsiab lus yuav thauj khoom hauv qab nws. Kuv ntseeg tias qhov no tshwm sim vim tias navbar tau nyam mus rau sab saum toj ntawm qhov chaw saib tsis siv nplooj ntawv nws tus kheej. Txawm hais tias qhov no tau kho los ntawm kev nce qhov chaw nruab nrab ntawm navbar thiab cov ntsiab lus tas.

pdf siab

Qhov siab qhov siab ntawm cov ntaub ntawv pdf yog qhov me me kawg. Nws yog qhov tseem ceeb nyeem tsis tau, yog li kuv hloov qhov siab kom sim thiab muab chav txaus rau ntxhib ib nplooj ntawv ib zaug.

Kauj ruam 4: Javascript Frame (javascript.js)

Javascript Frame (javascript.js)
Javascript Frame (javascript.js)

/ * * Qhov no tshawb nrhiav rau ib qho twg nrog chav 'toggle' thiab zais lossis zais nws */ ua haujlwm toggleSection (id, toggleID) {yog (document.getElementById (id)) {var divID = document.getElementById (id); var divArray = document.getElementsByClassName (toggleID);

rau (var i = 0; kuv <divArray.length; i ++) {divArray .style.display = "tsis muaj"; }

divID.style.display = "thaiv";

}

rov dag;

}

/*

* Txoj cai uas yuav tsum tau khiav hauv qee qhov kev txiav txim */ $ (daim ntawv). Npaj txhij (muaj nuj nqi () {/ * * Thauj khoom hauv cov ntsiab lus los ntawm cov ntaub ntawv */

/*

* Yuam kom ncua sijhawm me me los thauj cov ntaub ntawv */ setTimeout (muaj nuj nqi () {/ * * Ua kom pom tseeb tag nrho cov cai uas tau thauj khoom hauv */ $ ('ua ntej code'). Txhua (muaj nuj nqi (kuv, thaiv) { hljs.highlightBlock (thaiv);});}, 1000); });

Txhawm rau ua cov ntaub ntawv no yooj yim los hloov kho thiab tswj hwm, Kuv txiav txim siab siv hom ib nplooj ntawv. Nws khaws txhua yam hauv zos rau feem ntau thiab ua rau cov ntsiab lus nrawm dua.

ToggleSection

Kuv siv chav kawm qhov tseem ceeb los tswj hwm cov ntsiab lus yuav tsum tau qhia lossis zais vim feem ntau kuv tab tom siv divs los cais thiab pab pawg ntau yam ua ke. Koj tuaj yeem siv qhov no los ua ke ua ke cov khawm ib leeg ib yam nkaus, tab sis nws xav tau kev tshuaj xyuas ntxiv ua ntej teeb tsa "thaiv" tso cai kom tsis muaj cov ntsiab lus pom.

cov ntaub ntawv thauj khoom

Kuv suav nrog qhov no vim tias nws feem ntau tsis txaus ntseeg kom suav nrog ib pawg ntawm txoj haujlwm ywj pheej hauv cov ntaub ntawv HTML ib txwm muaj. Peb tuaj yeem siv txoj hauv kev ntawm qhov tseem ceeb hloov pauv kom yuam cov txheej txheem kom tshwm sim tom qab peb thauj cov ntsiab lus los ntawm lwm cov ntaub ntawv.

$ ('#mq2-intro'). load ("files/tutorials/mq2/mq2-intro/content.html");

Nov yog qhov piv txwv ntawm yuav ua li cas peb mam li thauj cov ntsiab lus.

Kauj ruam 5: Navigation Bar

Navigation Bar
Navigation Bar
Navigation Bar
Navigation Bar
Navigation Bar
Navigation Bar

Kev pib

  • Tsev
  • Txog Kuv
  • Cov phiaj xwm qhia
  • Tiv tauj kuv
  • Cov ntawv qhia chaw yog lub ntsiab lus nyuaj tshaj plaws ntawm txhua yam hauv cov ntaub ntawv. Kev sib xyaw ua ke ntawm cov chav kawm ua rau nws zoo li cov duab dhos ua si uas xav kom koj saib tas li ntawm phau ntawv txoj cai.

    Bootstrap Functionality

    Bootstrap ua haujlwm tseem ceeb los ntawm cov chav kawm sib txawv. Saib ntawm "nav" keeb kwm nws tus kheej, nws tsis nyuaj rau paub lub hom phiaj ntawm txhua chav kawm:

    Peb "navbar" yog "md" (nruab nrab), "nthuav" muaj peev xwm, "tsaus ntuj" xaiv. Thiab peb "kho" nws mus rau "sab saum toj." Nws zoo li tsis meej pem vim tias nws yog qhov tsis txaus ntseeg ntawm tus cim, tab sis yog tias koj saib lawv li cov lus sib txuas rau lub hauv paus, nws yooj yim dua rau nkag siab tias muaj dab tsi tshwm sim.

    Hom

    Hom yog lub cim raug thiab lub npe uas koj pom ntawm txhua lub vev xaib nyob rau sab saud. Nws yog qhov sim-thiab-tseeb tsim lub ntsiab lus uas txhua tus neeg siv xav tau ntawm lub sijhawm no.

    Nco tseg: Cov cim "i" yeej yog FontAwesome icons, thiab koj tau txais cov cim npe no los ntawm ib lub cim nplooj ntawv.

    Toggler/Collapsible Khawm (Txawb)

    Lub pob no tsuas yog qhia tawm ntawm cov khoom siv mobile. Tab sis txij li peb tau suav nrog hauv "nav" tshaj tawm tias lub nkoj nrhiav yuav tsum nthuav dav, cov ntsiab lus no txuas rau ib leeg dhau los ntawm lawv tus ID thiab "cov ntaub ntawv-toggle" tus cim.

    Navbar Txuas (Sab Sab)

    Cov kev txuas no tag nrho nyob ntawm seb pawg twg koj xav tau rau koj cov ntaub ntawv sau tseg. Kuv suav nrog qee qhov piv txwv raws li qhov pib, tab sis tsis muaj leej twg zoo ib yam. Koj yuav tsis xav tau ntu "Tutorials" vim tias koj tsom mus rau kev kos duab kos duab. Txhua qhov "li" cov khoom tuaj yeem theej thiab muab tshuaj txhuam, yog li thaum koj txiav txim siab yam koj xav tau, nws yooj yim los teeb tsa kev taw qhia.

    Nco tseg: Koj tuaj yeem thev naus laus zis tsim cov ntawv qhia zaub mov hauv lwm cov ntawv qhia zaub mov, tab sis kuv tsis xav kom nws tshwj tsis yog koj txaus siab ntxiv ntau CSS thiab Javascript los ua kom lub ntsej muag zoo dua.

    Navbar Links (Sab xis)

    Los ntawm muab cov npe raug ntawm cov txuas "ml-auto" chav kawm, Bootstrap sib npaug sib cais ob daim ntawv sib npaug. Qhov no tsim kev sib faib sab laug thiab sab xis. Kuv txiav txim siab siv qhov chaw no rau kev tshaj xov xwm sib txuas vim tias nws yog ib txoj hauv kev zoo heev thiab nrov los ua kom koj lub xub ntiag muaj ntau. Yog tias tsis muaj feem cuam tshuam, koj tuaj yeem tshem cov kab ntawv txuas rau kab ntawv tshawb nrhiav, nkag mus rau cov ntaub ntawv, thiab lwm yam. Tab sis tsuas yog nco ntsoov tias nws yog qhov chaw tseem ceeb uas yuav siv. Thiab zoo ib yam li cov navbar txuas ntawm sab laug, koj tuaj yeem luam tawm thiab muab cov no ib yam.

    Nco tseg: Yog tias koj npaj yuav siv cov txuas kuv twb tau teeb tsa, hloov qhov "username" hauv qhov tseeb "href" txuas lawv tus kheej.

    Kauj Ruam 6: Homepage

    Homepage
    Homepage
    Homepage
    Homepage
    Homepage
    Homepage

    Koj Lub Npe

    Programmer Writer Gamer

    Nqe lus no, thiab koj cov nplooj ntawv tom ntej ntawm cov ntsiab lus, yuav nyob ntawm seb koj xav muab tso rau hauv koj cov ntaub ntawv sau tseg. Kuv pom tseeb tsis tuaj yeem hais txhua txhua hom ntsiab lus, tab sis kuv tau sim suav nrog cov duab, pdfs, yeeb yaj kiab, cov lej thaiv, qee qhov kev suav nrog.

    Cov Qauv Ntawv

    Lub vev xaib tau teeb tsa los ua lub rooj. Kuv yuav tsis cia siab rau kuv qhov txuj ci tsim tsim los tsim koj cov khoom kawg, tab sis kuv ntxiv qhov sib txawv sib txawv ntawm kab thiab kab sib txuas ua ke los qhia tias nws muaj zog heev thiab yoog raws. Koj tuaj yeem tsim 3 kab thiab 2 kab kom muaj cov nyees khawm nyob rau sab laug thiab cov ntsiab lus ntawm sab xis, lossis koj tuaj yeem ua qee yam txawv. Nws tsuas yog siv me ntsis kev sim.

    Nyees khawm

    Cov haujlwm no yeej zoo ib yam li cov nyees khawm ib txwm ua. Tsuas yog kev sib koom Bootstrap tiag tiag ntawm no los ntawm kev ua kom haum nrog lwm cov ntsiab lus. Txwv tsis pub, tsim kom muaj ntau lossis tsawg dua cov nyees khawm raws li koj xav tau los nthuav tawm koj cov ntsiab lus thiab tom qab ntawd nco ntsoov ua kom sib phim href txuas nrog IDs rau divs.

    Txoj Cai Kawm Ntawv Cov Ntsiab Lus

    Cov cim "cim" yog cov cim npe ua ntej uas yog qhov tseem ceeb.js siv los tswj hwm txhua qhov tseem ceeb. Yog tias koj nco qab los ntawm javascript.js cov ntaub ntawv, muaj ntu kom thauj cov ntsiab lus los ntawm lwm cov ntaub ntawv.

    $ ('#home-programmer-macro'). load ("cov ntaub ntawv/tsev/watchLoot.mac");

    • Thawj ntu ntawm qhov no saib rau "id" ntawm lub hauv paus koj xav kom ntxig cov ntsiab lus rau hauv.
    • Qhov thib ob yog qhov chaw nyob ntawm cov ntawv koj xav thauj khoom.

    Nco tseg: Cov ntsiab lus yuav tsis thauj khoom tag nrho vim tias muaj lub sijhawm zoo uas koj tab tom kho nplooj ntawv web no hauv ib cheeb tsam es tsis txhob siv ntawm server. Qhov no tuaj yeem hais los ntawm ntau txoj hauv kev sib txawv uas kuv yuav hais tom kawg ntawm Cov Lus Qhia.

    Yeeb yaj duab YouTube

    Qhov kos "iframe" tiag tiag los ntawm YouTube nws tus kheej. Kuv yuav tsis piav qhia yuav ua li cas kom tau lawv, tab sis thaum koj mus rau "Qhia" cov vis dis aus, muaj qhov "Nkag" qhov kev xaiv uas yuav pab koj tsim cov cai tsim nyog los qhia koj cov vis dis aus ntawm nplooj ntawv web.

    Kauj Ruam 7: Nrhiav Tom Ntej

    Muaj lub sijhawm zoo heev uas kuv tsis tau npog qee lub ntsiab lus lossis hom ntsiab lus uas koj xav suav nrog hauv koj lub vev xaib. Ua tsaug ntau ntau txoj kev xaiv zoo rau koj ua cov kauj ruam tom ntej koj tus kheej.

    Bootstrap Cov Ntaub Ntawv

    Bootstrap cov ntaub ntawv yog qhov chaw zoo los pib yog tias koj tab tom nrhiav cov ntsiab lus uas tau npaj ua ntej thiab muaj cov piv txwv koj tuaj yeem luam thiab muab tso rau hauv koj cov ntaub ntawv ua piv txwv. Kuv tsis tau kov ntawm Daim Npav, Carousels, lossis Daim Ntawv. Kuv pom zoo kom koj saib dhau ntawm "Cheeb Tsam" ntu kom pom cov kev xaiv.

    W3Schools

    W3Schools yog lub vev xaib zoo uas koj tuaj yeem kawm paub txhua yam ntsig txog kev tsim web thiab kev txhim kho. Lawv ntse dua kuv li, thiab lawv npog tsuas yog txhua qhov HTML, CSS, thiab Javascript ua haujlwm uas koj tuaj yeem xav txog.

    Hosting Koj Portfolio

    Cov Lus Qhia no qhia koj yuav ua li cas tuav koj lub vev xaib ntawm ob peb lub platform sib txawv. Cov no yog cov kauj ruam uas koj yuav tsum tau ua yog tias koj xav kom tuaj yeem qhia tib neeg, cov neeg nrhiav neeg ua haujlwm, thiab lwm yam.

    Sim thiab Muaj Kev Lom Zem

    Tib txoj hauv kev koj yuav ua cov ntaub ntawv zoo yog los ntawm kev sim thiab sim txhua yam thiab txhua yam uas zoo li nthuav. Ntau qhov kev tsim qauv zoo nkauj thiab cov vev xaib siv cov txiaj ntsig hloov pauv zoo lossis keeb kwm yav dhau los, tab sis tsis muaj leej twg tuaj ua ntej.

Pom zoo: