How to add margin to a Label in asp.net

asp.net example - label margin
label-margin.aspx

<%@ Page Language="C#" AutoEventWireup="true"%>  
    
<!DOCTYPE html>
      
<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Label1.CssClass = "LabelMarginStyle";

        //another way to apply margin in label control.
        //Label1.Style.Add("margin","25px");
    }  
</script>      
      
<html xmlns="http://www.w3.org/1999/xhtml">      
<head id="Head1" runat="server">      
    <style type="text/css">
        .LabelMarginStyle {
            margin:25px;
        }
    </style>      
    <title>asp.net example - label margin</title>
</head>      
<body>      
    <form id="form1" runat="server">      
    <div>      
        <h2 style="color:MidnightBlue; font-style:italic;">      
            asp.net example - label margin
        </h2>      
        <hr width="550" align="left" color="Gainsboro" />      
        <asp:Label       
            ID="Label1"       
            runat="server"      
            Text="sample label to test label margin."
            BorderColor="Green"
            BorderWidth="1"
            Font-Size="X-Large"
            Width="350"
            >      
        </asp:Label>      
        <br /><br /><br />
        <asp:Button   
            ID="Button1"   
            runat="server"   
            Text="label margin"  
            OnClick="Button1_Click"
            Height="40"  
            Font-Bold="true"  
            />  
    </div>      
    </form>      
</body>      
</html>
More asp.net examples