Txoj hauj lwm
Siv cov kev pab no kom sai kho txoj hauj lwm ntawm ib lub caij.
Tsau saum
Muab cov khoom tso rau saum toj ntawm qhov chaw saib, los ntawm ntug mus rau ntug. Nco ntsoov tias koj nkag siab qhov cuam tshuam ntawm txoj haujlwm ruaj khov hauv koj qhov project; Tej zaum koj yuav xav tau ntxiv CSS ntxiv.
<div class="fixed-top">...</div>
Tsau hauv qab
Muab cov khoom tso rau hauv qab ntawm qhov chaw saib, los ntawm ntug mus rau ntug. Nco ntsoov tias koj nkag siab qhov cuam tshuam ntawm txoj haujlwm ruaj khov hauv koj qhov project; Tej zaum koj yuav xav tau ntxiv CSS ntxiv.
<div class="fixed-bottom">...</div>
nplaum sab saum toj
Muab cov khoom tso rau saum toj ntawm qhov chaw saib, los ntawm ntug mus rau ntug, tab sis tsuas yog tom qab koj scroll dhau nws. Kev .sticky-top
siv hluav taws xob siv CSS's position: sticky
, uas tsis txaus siab rau txhua qhov browsers.
<div class="sticky-top">...</div>
Teb nplaum sab saum toj
Teb variations kuj muaj rau kev .sticky-top
siv.
<div class="sticky-sm-top">Stick to the top on viewports sized SM (small) or wider</div>
<div class="sticky-md-top">Stick to the top on viewports sized MD (medium) or wider</div>
<div class="sticky-lg-top">Stick to the top on viewports sized LG (large) or wider</div>
<div class="sticky-xl-top">Stick to the top on viewports sized XL (extra-large) or wider</div>