We launched a new IT training category! Check out the 140+ courses now.

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

Overriding Bootstrap core CSS

From: Up and Running with Bootstrap 2

Video: Overriding Bootstrap core CSS

Finally, the video you all have been waiting for: how do you override the core CSS in Bootstrap? Well, there are two possible ways that you can do this. I am on the getbootstrap.com website, and I've clicked on the Customize link, and this is the page where you can customize Bootstrap to do exactly what you need it to do and nothing more. So, you can choose exactly which components you want to include. We talked a little bit about the Scaffolding, much of the rest of this we haven't talked about yet, but these are JavaScript-driven widgets that I'm going to cover in a couple of videos, some of the styling that's in CSS you can choose to include it or not, you can choose to include specific plug-ins that we rely on jQuery, you can customize these variables.

Overriding Bootstrap core CSS

Finally, the video you all have been waiting for: how do you override the core CSS in Bootstrap? Well, there are two possible ways that you can do this. I am on the getbootstrap.com website, and I've clicked on the Customize link, and this is the page where you can customize Bootstrap to do exactly what you need it to do and nothing more. So, you can choose exactly which components you want to include. We talked a little bit about the Scaffolding, much of the rest of this we haven't talked about yet, but these are JavaScript-driven widgets that I'm going to cover in a couple of videos, some of the styling that's in CSS you can choose to include it or not, you can choose to include specific plug-ins that we rely on jQuery, you can customize these variables.

Bootstrap makes use of the less framework, and you can type in different values for these things. So the easiest one to understand is here under Colors. So what exact shade of blue would you like to have where blue occurs inside of your document, what exact shade of green and so forth? So you can customize all these variables and type in your own values and then customize here and download by clicking on the big honking button at the bottom of the page that will download exactly what it is that you want to have for your website.

However, there are some major downsides to customizing your Bootstrap Installation this way, particularly where the CSS is concerned. First of all, in the course of preparing for this video, Bootstrap released two new versions. I started working with Bootstrap 2.0.4, and just yesterday 2.1.1 was released, so obviously these new releases are happening all the time. If you want to update your website to the latest version of Bootstrap, right now what you would do is simply download the latest version, replace the existing CSS and JavaScript files with the new versions that you would download from the Bootstrap site, which is great until you realize that any customization that you've done to bootstrap.css or bootstrap-responsive.css will instantly be lost, because you'll overwrite those files with the new ones that you've downloaded.

So you'll either need to now as part of that process keep track of where all those customizations are and retype them in here on the screen, or you'll have to keep track of what they are and re-enter them when you upgrade your version of Bootstrap, and that's just too much work for me. I can't remember what I've changed and what I haven't changed. So, I think a far better approach is to create a custom stylesheet and put any changes that you're going to include there. Anything you're going to override or any additional styling that you're going to include, put it all in that stylesheet, and that will make your website so much more maintainable.

It'll be so easy to upgrade the latest version of Bootstrap, because then you'll just copy those new files in over the old files and your customizations are all still intact. So, let me show you how to do that process now. Back here in Dreamweaver, I'm going to go ahead and I'm going to create a new document, so File > New, and this time it's going to be a stylesheet. So I'm going to pick Stylesheet from my Page Types over here and say Create, and it's going to create a blank stylesheet document for me. Because this is just a proof of concept thing, I'm going to make a really quick change here.

I am going to go ahead and change the body background color to a lovely shade of green, so I'm going to say background-color is bada66, and I'm going to go ahead and save that, File > Save. So I'm going to go to Desktop, to my Bootstrap folder, to my CSS folder, and I'm going to save this as custom.css, so that is my custom stylesheet.

Now the next thing I have to do is attach it to the document I have been working on, so here's my schedule.html, which is the document I've been working on in this chapter. I'm going to click here just after the style sheet for bootstrap-responsive, and I'm going to insert my stylesheet here. So, over here on the right side of the screen, if you click on the Link icon here inside of the CSS Styles palette and you choose the Custom Style Sheet here from the list, go ahead and say OK. It'll go ahead and write in the code to include your custom style sheet right here inside of your document.

Again, you want it to occur last in the string of style sheets, because remember, anything that you put in your custom style sheet you're going to want to override what comes before it, and so if you put this custom.css stylesheet somewhere further up the line, closer to the title tag in the code that I'm working with here, it may not necessarily override the default styling from Bootstrap. Okay, once you've got that in place, File > Save, we can go ahead and take a look at this in Firefox, and if I Refresh the page that I'm working on, you can now see that we have a lovely shade of green behind our text here, and the icons that we put it in, in the previous lesson you can see that we have a nice dark icon, we also have a white icon, we have some white here associated with our block quote, and if we scroll on down the page a little farther, this image here that had that class applied to it, image-polaroid, you can see that it has a nice white stripe around in addition to that thin light gray stripe that goes around it as well.

So that is how you add custom styles to your document. Make sure you put them in a separate style sheet, call it whatever you like, I usually call mine custom.css because it's pretty clear what that is, and then make sure you link it to your document after any other style declarations that are on your page so that it'll override things correctly.

Show transcript

This video is part of

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

32 video lessons · 20001 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 preferences from 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.