How to justify the text in a Label in asp.net

asp.net example - label justify text
label-justify-text.aspx

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

        //another way to apply label justify text.
        //Label1.Style.Add("text-align","justify");
    }  
</script>      
      
<html xmlns="http://www.w3.org/1999/xhtml">      
<head id="Head1" runat="server">      
    <style type="text/css">
        .LabelJustifyTextStyle {
            text-align:justify;
        }
    </style>      
    <title>asp.net example - label justify text</title>
</head>      
<body>      
    <form id="form1" runat="server">      
    <div>      
        <h2 style="color:MidnightBlue; font-style:italic;">      
            asp.net example - label justify text
        </h2>      
        <hr width="550" align="left" color="Gainsboro" />      
        <asp:Label       
            ID="Label1"       
            runat="server"      
            Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's..."
            BorderColor="Red"
            BorderWidth="1"
            Font-Size="X-Large"
            Width="350"
            >      
        </asp:Label>      
        <br /><br /><br />
        <asp:Button   
            ID="Button1"   
            runat="server"   
            Text="label justify text"  
            OnClick="Button1_Click"
            Height="40"  
            Font-Bold="true"  
            />  
    </div>      
    </form>      
</body>      
</html>
More asp.net examples