asp.net example - label margin-top
label-margin-top.aspx
<%@ Page Language="C#" AutoEventWireup="true"%>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
Label1.CssClass = "LabelMarginTopStyle";
//another way to apply top margin in label control.
//Label1.Style.Add("margin-top","50px");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<style type="text/css">
.LabelMarginTopStyle {
margin-top:50px;
}
</style>
<title>asp.net example - label margin-top</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:MidnightBlue; font-style:italic;">
asp.net example - label margin-top
</h2>
<hr width="550" align="left" color="Gainsboro" />
<asp:Label
ID="Label1"
runat="server"
Text="sample label to test label top margin."
BorderColor="HotPink"
BorderWidth="1"
Font-Size="X-Large"
Width="350"
>
</asp:Label>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
Text="label margin-top"
OnClick="Button1_Click"
Height="40"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>
- How to add an onClick event to a Label
- How to create a multiline Label
- How to databind Label
- How to display html tags in a Label
- How to add margin to a Label
- How add padding to a Label
- How to apply ListBox auto height
- How to remove selected items from ListBox
- How to add attributes to a ListBox items
- How to show ScrollBar in a CheckBoxList