4
I am learning to program an application based on MVC4 and Bootstrap. At the beginning of the project I came across a puzzle:
In the _Layout.cshtml I had <link href="css/bootstrap.css" rel="stylesheet">
, Bootstrap worked well on one view (Home/BootSchool
) and the other did not format HTML (Student/AllStudents
). After some research I solved my problem using <link href="@Url.Content("~/css/bootstrap.css")" rel="stylesheet">
.
Does it have anything to do with the redirect? In the page source code, the link is the same in both modes and when I click on it I am redirected correctly to the Bootstrap CSS.
I thought that would be exactly the difference, but I was surprised when I was redirected correctly in both cases to the correct file. The source code had exactly the same link for both cases(/css/bootstrap.css).
– ihavenokia
It is quite normal to put the reference fixed, but it is not a good practice because it makes room for problems.
– Leonel Sanches da Silva