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
, andcol-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 ...
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.