[英]Changing background-color of header is not working
Hello this is my first question on stackoverflow so excuse my inexperience.您好,这是我关于stackoverflow的第一个问题,请原谅我的经验不足。
I am trying to change the background color of an entire HTML document using background-color on the element although some of the document changes color, I can't change the background-color, I tried changing it with inline css on the element and it's not working, yet I can change the height attribute.我正在尝试使用元素上的背景颜色更改整个 HTML 文档的背景颜色,尽管某些文档会更改颜色,但我无法更改背景颜色,我尝试使用元素上的内联 css 更改它不工作,但我可以更改高度属性。
This is bugging me for hours and I am confused.这困扰了我几个小时,我很困惑。
This is my first ASP.net Core Web Application using MVC model so I am using the automatically generated file "_Layout.cshtml"这是我的第一个 ASP.net Core Web 应用程序使用 MVC model 所以我使用自动生成的文件“_Layout.cshtml”
<body style="background-color: #767678;">
<header style="background-color: #767678; height:100px;">
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">MovieLover</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<partial name="_LoginPartial" />
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Movies" asp-action="Index">Movies</a>
</li>
<li class="nav-item">
<img src="https://users.iee.ihu.gr/~it174985/imgs/search.svg" />
</li>
<li class="nav-item">
<input type="text" value="Search" style="margin-top:5px; width:600px" />
</li>
</ul>
</div>
</div>
</nav>
</header>
I also post a picture of the website so you can see how it looks.我还发布了该网站的图片,以便您查看它的外观。 => 1 => 1
Thank you all for your time any answer will be appreciated谢谢大家的时间任何回答将不胜感激
Following Dr J Manish reply the problem was fixed all I had to do was remove navbar-light and bg-white from the nav element在 J Manish 博士回复之后,问题得到了解决,我所要做的就是从 nav 元素中删除 navbar-light 和 bg-white
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.