Is there a way to add Material Design to ASP.NET Webforms?

Brian Tan 40 Reputation points
2023-08-22T00:06:23.8533333+00:00

I haven't found many resources to add Material Design to ASP.NET Webforms.

The closest I found was this stackoverflow which didn't help much.

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,312 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lan Huang-MSFT 26,516 Reputation points Microsoft Vendor
    2023-08-22T02:56:17.74+00:00

    Hi @Brian Tan,

    You can add materialize-css via npm, then copy the materialize.min.css and js files to a directory in your scripts folder and reference them in _layout.cshtml.

      npm install materialize-css@next
    

    If you don't want to use npm, you can use a CDN link.Below is a simple example.

    For more information see the documentation below.

    Learn how to easily start using Materialize in your website.

    this github about Material Components for the web

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <!-- Compiled and minified CSS -->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" />
    
        <!-- Compiled and minified JavaScript -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
        <!--Import Google Icon Font-->
        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <a class="waves-effect waves-light btn">button</a>
                <a class="waves-effect waves-light btn"><i class="material-icons left">cloud</i>button</a>
                <a class="waves-effect waves-light btn"><i class="material-icons right">cloud</i>button</a>
    
            </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