Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Adding a page for next and previous links

From: Up and Running with Bootstrap 2

Video: Adding a page for next and previous links

I'm here on the lynda.com blog at www.lynda.com/articles. And one of the navigation elements that the lynda.com blog uses is down here at the very bottom of the web page. So if you scroll all the way down to the bottom of the blog, you'll notice down here in the bottom there is this little link that says Older Entries. This is a very common type of navigation that you see in blogs, so if I click this link that says Older Entries, and I go all the way down to the bottom of the page, again, you'll notice that it now it says Older Entries and Newer Entries.

Adding a page for next and previous links

I'm here on the lynda.com blog at www.lynda.com/articles. And one of the navigation elements that the lynda.com blog uses is down here at the very bottom of the web page. So if you scroll all the way down to the bottom of the blog, you'll notice down here in the bottom there is this little link that says Older Entries. This is a very common type of navigation that you see in blogs, so if I click this link that says Older Entries, and I go all the way down to the bottom of the page, again, you'll notice that it now it says Older Entries and Newer Entries.

This type of navigation lets you page basically back and forth between parts of this blog just by clicking these links. We can go back a page in time or go forward a page in time. This is called Pager inside of Bootstrap, so a Pager allows you to style these links for next and previous or older and newer that you see at the bottom of these pages. So if you hop on into Dreamweaver, you'll notice that I've given you some really simple markup, this is just a two-bullet list.

Just a ul with the two bullets that say Previous and Next. Styling this is just as easy, so we're going to start by adding up here on the top a class of pager inside of the ul tag. And that will take care of the styling for our Previous and Next buttons with Bootstraps defaults. If you just go ahead and save that document, and we preview it inside of Firefox, you'll see now that we have two links, Previous and Next, I can roll over them, you can see that they have a very nice hover state as well. So that's great! You may be wondering, what if I want to space these out so that they're at the edges of whatever area I've included these particular buttons in? So, for example, at the bottom of the lynda.com blog we've pushed Older and Newer Entries to the very edges of the blog here.

What if I want to push these two buttons apart as well? Well, that's completely possible. If you hop back into Dreamweaver again, we're going to add two classes. The first li for Previous, we're going to add a class of previous. And for the next button labeled Next, I'm sure it'll be shock to learn we add a class of Next. So just by doing that, this will push these two buttons to the edges of the web page, and Previous would indicate the side where you want it to say older or further back in time, the left side of the page, and the one where it says Next, you want to push to the right side of the page, or going into the future.

So if we Refresh our web page, here we go. Now you see that I've pushed these all the way to the edges of the page. Because I don't have any of the Scaffolding included inside of this HTML document, these are pushed all the way to the edges of the window. Of course, these will be pushed to the edges of its containing element if you had some additional markup here. So if you have these in the bottom of some kind of div, let's say with a span of four, it will be pushed to the edges of that. In other words, about a third of the screen width, instead of the entire screen width, as you see here.

So that's great, but what if there are no previous entries? What if I would like to have that Previous button sort of grayed out? Just as we've seen before in the last video, you can add a class of disabled, disabled will gray this button out. So if you go ahead and Save that one more time, Refresh your web page, you'll see now that the previous button is grayed out, there's no hover state, and the arrow stays when I roll my mouse over it, implying that this is not a clickable button. But just as I pointed out in the previous video, it most assuredly is a clickable button.

We've used CSS here to make it look like it's not. So if you really truly don't want this button to be clickable, you're going to have to find some way of getting rid of that link or using more JavaScript tricks or using some kind of programming language to make this truly a not clickable button. The next button, of course, still remains clickable. All right, so this is some very simple markup here for including Next and Previous or Older and Newer buttons inside of your web pages. If you want to flip forward a page or back in time, they're very commonly used at the bottom of blog entries.

And you can combine this with a couple of classes to give this some nice styling and some great functionality.

Show transcript

This video is part of

Image for Up and Running with Bootstrap 2
Up and Running with Bootstrap 2

32 video lessons · 19604 viewers

Jen Kramer
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with Bootstrap 2.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.