为什么DIV在此代码中的ASP标记内无效?

RKh*_*RKh 1 html css asp.net .net-3.5

以下是我的Web内容表单的代码.ASP标记内的DIV显示绿色下划线,并且在内容页面上也看不到用DIV标记写入的文本.

<%@ Page Title="" Language="C#" MasterPageFile="~/Presentation_Layer/Pages/home.Master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="live1._default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
        <asp:Label ID="lblWelcomeMessage" runat="server" ForeColor="Black">
            <div id="divProfile"> 
                This is a test.
            </div>
        </asp:Label>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)

Ram*_*din 7

<asp:Label runat="server"/>span在浏览器上呈现为标记.

您不能将块级元素嵌套在元素内inline.label并且spaninline元素,DIV是块级别.