Using Bootstrap in your ASP.NET MVC application

There are different ways to get Bootstrap for your application:

  • Refer to the Bootstrap file available at the CDN (Content Delivery Network) in your application
  • Download the source code
  • Install with Bower
  • Compile with Grunt

Of these options, the easiest option is the first one.

Open the layout file (_Layout.cshtml) in the application that we created earlier. Include the CSS files at the top (within the head tag) and the scripts at the bottom (at the end of the body tag):

<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" ...

Get ASP.NET Core: Cloud-ready, Enterprise Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.