DIV color problem

Peter Volz 220 Reputation points
2023-05-24T17:05:59.2866667+00:00

Hello

I have this html style and body code:

.btn{
padding: 10px 20px;
-webkit-border-radius:3px;
border-radius:3px;
width:180px;
margin: 5px auto;
}

<div class="btn" style="background-color:#917AD1;color:#6E852E">Birthday</div>
<div class="btn" style="background-color:#7399E0;color:#8C661F">Blue category</div>

back color and font color must be set for each div separately, but font color won't work

ASP.NET Web Forms
ASP.NET Web Forms
A part of the ASP.NET web application framework that can be used to create ASP.NET web applications.
549 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lan Huang-MSFT 14,986 Reputation points Microsoft Vendor
    2023-05-25T02:16:56.1633333+00:00

    Hi @Peter Volz,

    I tested your code and it works fine.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style>
            .btn {
                padding: 10px 20px;
                -webkit-border-radius: 3px;
                border-radius: 3px;
                width: 180px;
                margin: 5px auto;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
            <div class="btn" style="background-color:#917AD1;color:#6E852E">Birthday</div>
    <div class="btn" style="background-color:#7399E0;color:#8C661F">Blue category</div>
        </form>
    </body>
    </html>
    

    User's image

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful