O'Reilly logo

ASP.NET Core: Cloud-ready, Enterprise Web Application Development by James Singleton, Valerio De Sanctis, Mugilan T. S. Ragupathi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

HTML doctype

Bootstrap makes use of certain HTML elements and CSS properties that require the use of HTML 5 doctype. By default, the view that you create in ASP.NET Core will have HTML 5 doctype only. So, we do not need to do anything regarding this.

 
<!DOCTYPE html> 
 
<html lang="en"> 
... 
</html> 

Let us make the following changes to our screen to make use of Bootstrap:

  • Apply the CSS class form-horizontal to the form.
  • For the label, input, and validation error spans use the CSS col-sm-2, col-sm-4, and col-sm-3 classes respectively
  • For labels, apply the CSS class control-label
  • For input HTML elements, the form-control CSS class is applied
  • For each of the form groups (containing the HTML elements such as label and input), apply the CSS class form-group ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required