New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

Up and Running with Bootstrap 2
Illustration by

Adding a hero unit


From:

Up and Running with Bootstrap 2

with Jen Kramer

Video: Adding a hero unit

A hero unit is a big area usually spanning the width of a web page that intends to draw user attention. For example, I'm looking at the lynda.com homepage, and this site is not built with a Bootstrap framework, but if it was, this particular area at the top of the page where you see the text here and the video over on the side, this would be considered a hero unit, and we're going to try implementing one of these in the new document that I'm starting for this particular video. So if you go to the new document that I've given you in your exercise files, open that up, we're going to go ahead and add a hero unit to this particular page.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
Up and Running with Bootstrap 2
2h 38m Beginner Oct 12, 2012

Viewers: in countries Watching now:

Bootstrap is a free web development tool from Twitter that, with a little bit of CSS and JavaScript experience, makes building websites quick, intuitive, and fun. Author Jen Kramer explores its 12-column grid layout; typography and icon libraries; fully functional components like nav bars, buttons, and tabs; and much more. This course also shows how to add JavaScript extras like dropdown menus, modal windows, and photo carousels.

Topics include:
  • Understanding the difference between default and fluid grids
  • Nesting with fluid grids
  • Creating a thumbnail gallery
  • Adding block quotes and lists of text
  • Incorporating images and icons
  • Adding breadcrumb navigation and pagination
  • Using tabs and pills navigation
  • Making the nav bar responsive with JavaScript
  • Adding dropdown menus to the nav bar, tabs, and pill
Subjects:
Web Responsive Design Web Design Web Development
Software:
Bootstrap
Author:
Jen Kramer

Adding a hero unit

A hero unit is a big area usually spanning the width of a web page that intends to draw user attention. For example, I'm looking at the lynda.com homepage, and this site is not built with a Bootstrap framework, but if it was, this particular area at the top of the page where you see the text here and the video over on the side, this would be considered a hero unit, and we're going to try implementing one of these in the new document that I'm starting for this particular video. So if you go to the new document that I've given you in your exercise files, open that up, we're going to go ahead and add a hero unit to this particular page.

So, we're starting from the very beginning of a Bootstrap document here. So as we've done before, we're going to start by adding a div with a class of container-fluid to have that big wrapping div that goes all the way around the web page, and I'll close that down here at the bottom. And then just as we've been doing all along, we have to start a row, so I'll have a div with a class of row-fluid and a slash div down here, and then in between that I'm going to go ahead and put them in my hero unit.

Now, in this particular page, the hero unit is really functioning as a big header at the top of the web page. It's the big thing that catches your attention, so I'm going to use the header tag from HTML5, and I'm going to give this a class of span12, because I want it to go all way across the page, and I'll go ahead and close that header down here at the bottom. I'm going to go ahead and add some text to this. In your exercise files on your desktop, you'll find a text document that has the copy in it that I'm going to use, so this will be the Roux Academy 2012 Art Conference, so I'm going to start by pasting that on in, and I'm going to put that in h1 tag, and then following that, I'm going to put in a bit more of a description, so I am going to put in a paragraph tag, and I'm going to follow that up with this text, right here, which I'll go ahead and highlight, Ctrl+C or Command+C to copy it, Ctrl+V or Command+V to paste that into the web page, and /p to end that paragraph.

And then I'm going to follow that up with a paragraph and a link, href. I'm not going to link this anywhere, because this is just one page of the website. Obviously, you'd put a link in there if you're doing this for real, and I'm going to put in a learn more at the end of all of this. So, if I just save what I have so far--File > Save--and I open this up in my web browser by going to the globe here and saying Preview in Firefox, you'll see that we have a page with a header and some text in the Learn more link. It's not really anything exciting yet.

It's not anything that we haven't already done in some of the previous videos. All right, so now that that's in place, let's go ahead and turn this into a hero unit, and the way that we do that is after the span12 we can add the class of hero-unit. So once again, if you save that--Ctrl+S or Command+S to Save--and bring up your web browser and view it in the browser, you'll see that immediately this has now been formatted very nicely. It's got a screen black box around it, the text is nice and large, it's definitely attention grabbing.

One other thing you might want to add to this would be a picture. You can certainly add an image to this very easily. If I hop back into Dreamweaver, and I go ahead and add let's say just after this header right here, I can put an image source, and in your exercise files you'll find that there was an image in place that you can go ahead and use for this. Be sure to give it an alt tag always.

Actually, before we close it, let me put in one more thing, a class of pull-right. And the class of pull-right is a utility class. There's actually a pull-left, and there is a pull-right. basically, these classes are designed to float an image left or right or anything else for that matter, other elements on your web page, and so if I go ahead and save what I've got so far--Ctrl+S or Command+S to Save--and if I refresh this in Firefox, and you take a look, there's my nice big image here to complement what I've done so far.

The last thing that I want to do here to make this look like a real hero box is deal with that link to learn more, and I want to cover buttons in much more detail in a later video, but for now in Dreamweaver, if you happen into the href tag here, we're going to go ahead and assign three classes. So a class of btn or button, btn-primary, which controls the color of the button actually, and I'm also going to add btn-large, which will make it a very large button.

So, once these three classes are in place, Ctrl+S or Command+S to save, and off to Firefox, go ahead and refresh, and you'll see that we have a very buttony looking Learn more link, even though that is just a regular old href type of thing. The styling that we've applied with Bootstrap gives it a very nice look for the button. So hero units are a great way to set off your homepage to really draw the user's attention to the website, make users aware of what's the most important thing on the web page.

In this case, I've marked it up with a header tag. It certainly doesn't have to be marked up that way, it doesn't even have to occur at the top of your web page. You could use this hero unit anywhere you like within your document, but I think I've suggested a nice way of putting it to use, and you can go ahead and give this a try on your own Bootstrap websites.

Find answers to the most frequently asked questions about Up and Running with Bootstrap 2.


Expand all | Collapse all
please wait ...
Q: I am trying to create the image carousels shown in this course, and they are not functioning properly. The custom.css file seems to be missing from the exercise files and I think this is the reason. Can you provide it?
A: custom.css isn't created until the carousel indicators are added. However, these styles have to do with the way the indicators look, and nothinghas to do with the way the carousel functions.
 
Are you sure you're working with Bootstrap 2.x? You download that from here: 
http://getbootstrap.com/2.3.2/. The carousel changed radically between Bootstrap 2.x and Bootstrap 3, and this course might not work with version 3.
 
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.
Upgrade now


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 Upgrade now

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

Notes cannot be added for locked videos.

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.