Creating dedicated layouts for multiple devices

Modern web applications use web page layouts to provide a consistent and coherent style. It is good practice to use HTML in combination with CSS to define this layout. In ASP.NET Core 3, the common web page layout definition is centralized on a layout page.

The layout page, usually called _Layout.cshtml, includes all the common user interface elements, such as the header, the menu, the sidebar, and the footer. Furthermore, common CSS and JavaScript files are referenced in the layout page so that they can be used throughout your entire application. This allows you to reduce code in your views, thus helping you to apply the Don't Repeat Yourself (DRY) principle.

We have been using a layout page since the very early versions of the Tic-Tac-Toe demo application, that is, when we added it for the first time in Chapter 4, Basic Concepts of ASP.NET Core 3 via a Custom Application: Part 1, to give our application a modern look, as you can see here:

Up until this point, our application has been more or less set up for the default browser, which is the PC. Is there any way we can differentiate our code based on respective devices? We'll look at the steps to achieve this in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.218.37