Viewers: in countries Watching now:
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 .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.