How to apply full background image in asp.net MVC

前端 未结 5 361
野性不改
野性不改 2021-01-12 09:02

I\'m new to asp.net MVC and I need to have a full background image on the login page. Im getting confused with all of the cshtmls and getting lost on where to set the full b

5条回答
  •  [愿得一人]
    2021-01-12 09:26

    If you want it on all pages use Shared/_Layout.cshtml file and change body tag similar to

    Probably I would put only on the Home/Index.cshtml page so it appears only on the home page To avoid that repeated across other pages I would add an ID to home page in the Shared/Index.chtml file as follows and change it in the Content/site.css file add #HomepageBody { background-image: url("/images/7flowers.jpg" ); background-repeat:no-repeat; background-position:center; }

    That would make it work across popular browsers like Chrome.

提交回复
热议问题