[CSS3] Use Sticky positioning for section Headers

Source: Internet
Author: User

We can take advantage of sticky positioning to keep a section header at the top of the page while the user scrolls. This was useful for neat categorisation of sections on the page.

  <DL>    <DT>Premier League</DT>    <DD>Brighton & Hove Albion 2-2 AFC Bournemouth</DD>    <DD>Burnley 1-2 Liverpool</DD>    <DD>Leicester City 3-0 Huddersfield Town</DD>    <DD>Stoke City 0-1 Newcastle</DD>    <DD>Everton 0-1 Manchester</DD>    <DT>Championship</DT>    <DD>Bolton Wanderers 1-0 Hull City</DD>    <DD>Derby County 1-1 Sheffield</DD>    <DD>Leeds 0-0 Nottingham Forest</DD>    <DD>Norwich City 2-1 Millwall</DD>    <DD>Preston North End 2-3 Middlesbrough</DD>    <DD>Queens Park Rangers 2-1 Cardiff City</DD>    <DD>Sheffield Wednesday 0-3 Burton Albion</DD>    <DD>Sunderland 0-1 Barnsley</DD>    <DD>Aston Villa 3-0 Bristol City</DD>    <DT>League 1</DT>    <DD>AFC Wimbledon 2-0 Southend</DD>    <DD>Bristol Rovers 2-1 Portsmouth</DD>    <DD>Charlton Athletic 1-2 Gillingham</DD>    <DD>Fleetwood Town 1-2 Bradford City</DD>    <DD>Northampton Town 0-1 Wigan Athletic</DD>    <DD>Oxford 3-1 Milton Keynes Dons</DD>    <DD>Peterborough 1-1 Doncaster Rovers</DD>    <DD>Plymouth Argyle 1-0 Walsall</DD>    <DD>Rochdale 1-2 Blackpool</DD>    <DD>Rotherham 1-1 Blackburn Rovers</DD>    <DD>Scunthorpe 1-0 Bury</DD>    <DD>Shrewsbury Town 1-0 Oldham Athletic</DD>  </DL>
{  font-size: 30px;}  {  background-color: mediumseagreen;    position: sticky;  /* Sticky positioning */   position: -webkit-sticky;   top: 0;}  {  padding: 20px 0;}

[CSS3] Use Sticky positioning to section Headers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.