ASP.NET: I'm getting strange output when styling a Label control...
- by pkiyan
.labelOne { border-width:thin;
border-style:solid;
border-color:Red;
background-color:Silver; }
<asp:Label ID="Label1" runat="server" CssClass="labelOne">
<h1>Hello world</h1>
</asp:Label>
<br /><br />
<asp:Label ID="Label2" runat="server"
BorderColor="Black"
BorderStyle="Solid"
BorderWidth="1px"
BackColor="Silver">
<h1>Hello world</h1>
</asp:Label>
Hello. In the code sample above I have 2 Label controls with their contents set to an h1 header tag. The first Label is styled using css, and the second with the Label's inline properties (both Labels have identical styling). But the first Label doesn't output properly, it's border is broken. If I replace the first Label's markup with plain "Hello world" text it renders properly, but it breaks again when I use markup. Can someone explain why this is happening?