locked
changing background color of asp webpages from master RRS feed

  • Question

  • User1879833939 posted

    i know there is a way you can put 

    <script><style>

    </style></script>

    within the head tags and and simple script to it ,however i have forgorten.assist

    Saturday, June 16, 2018 9:23 AM

All replies

  • User283571144 posted

    Hi mozina,

    changing background color of asp webpages from master

    According to your description, I couldn't understand your requirement clearly.

    Do you mean you want to change the  background color from master page with css?

    If this is your requirement, I suggest you could consider setting body's background-color css style to achieve your requirement.

    More details, you could refer to below codes:

    Notice: Changing the  body's background-color css in the master page will make all the web page's body  background-color css is the same color.

    Master:

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="AspNetNormalIssue.Site1" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title></title>
        <style>
            body {
             background-color:aqua;
            }
        </style>
        <asp:ContentPlaceHolder ID="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                </asp:ContentPlaceHolder>
            </div>
        </form>
    </body>
    </html>

    Result:

    Best Regards,

    Brando

    Monday, June 18, 2018 2:08 AM
  • User1359092739 posted
    body {
        background:#F00; /* #F00 being the hex representation of "red" */
    }
    Tuesday, June 19, 2018 7:38 AM