如何更改网页的背景颜色

时间:2018-03-28 13:42:33

标签: c# html css asp.net

我不确定如何更改网页的背景颜色。我一直在研究答案,他们一直指着bootstrap.css这是可以理解的,但是,我不知道如何将这些分配给特定的Web表单。

这是我放入bootstrap.css

的代码示例
body {
  margin: 0;
  background-color:#183adb;

}

这是我的网页,标记代码

<%@ Page Title="AddProject" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AddProject.aspx.cs" Inherits="help.AddProject" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

    <div class="Jumbotron">
        <h1>CREATE A NEW PROJECT:</h1>
    </div>
     <div class ="Container-fluid"> 
          <br />

        <div class ="Row">         
            <asp:Label ID="lblprojectName" runat="server" Text="Project Name"></asp:Label>  
        </div>

        <div class ="Row">      
            <asp:TextBox ID="txtProjectName2" runat="server" Width="517px" AutoPostBack="True" ForeColor="Black" AutoCompleteType="Disabled"></asp:TextBox>
        </div>
          <br />
    <div class ="Row">                 
            <asp:Label ID="lblProjectDesc" runat="server" Text="Project Description"></asp:Label>           
        </div>
        <div class ="Row">              
            <asp:TextBox ID="txtProjectDesc" runat="server" Height="52px" TextMode="MultiLine" Width="521px" AutoCompleteType="Disabled"></asp:TextBox>                  
        </div>
          <br />

    <div class ="Row">
            <asp:Label ID="lblDate" runat="server" Text="Start Date"></asp:Label>      
            </div>

        <div class ="Row">                   
                <asp:TextBox ID="txtDate" runat="server" Width="164px" AutoCompleteType="Disabled"></asp:TextBox>  &nbsp;<asp:Button ID="btnChangeDate" runat="server" Text="Change" OnClick="btnChangeDate_Click" />
            </div>
          <asp:Calendar ID="calStartDate" runat="server" OnSelectionChanged="calStartDate_SelectionChanged" Visible="False"></asp:Calendar>
          <br />

           <div class ="Row">
            <asp:Label ID="lblFinishDate" runat="server" Text="Finish Date"></asp:Label>      
            </div>

        <div class ="Row">                   
                <asp:TextBox ID="txtFinishDate" runat="server" Width="164px" AutoCompleteType="Disabled"></asp:TextBox> &nbsp;<asp:Button ID="btnChangeDate2" runat="server" Text="Change" OnClick="btnChangeDate2_Click" />                 
            </div>
         <asp:Calendar ID="CalFinishDate" runat="server" OnSelectionChanged="CalFinishDate_SelectionChanged"></asp:Calendar>
         </div>


    <div class = "Container-fluid">
        <br />
        <div class ="Row">
            <asp:Button ID="btnCreateProject" runat="server" Text="Save & Add" Height="40px" Width="94px" OnClick="btnCreateProject_Click" />
             <asp:Button ID="btnClearProject" runat="server" Text="Clear all" Height="40px" Width="94px" OnClick="BtnClearProject_Click" />
        </div>
    </div>
</asp:Content>

1 个答案:

答案 0 :(得分:1)

将CSS代码直接放在<head></head>标记内的Site.Master页面中,而不是放在bootstrap.css中:

<style>
    body {
      margin: 0;
      background-color: #183adb;
    }
</style>