简体   繁体   中英

Validation (HTML 4.01): Element 'style' cannot be nested within element 'div'

I am using ASP.NET 4.0 and I am writing an internal css in an aspx file. The style block is the first block in a ContentPlaceHolder . The style block is giving an error message

Validation (HTML 4.01): Element 'style' cannot be nested within element 'div'

Screenshot:

在此处输入图片说明

ContentPlaceHolder is in a div in Master page as follows

<div id="column2">
    <asp:ContentPlaceHolder ID="Content" runat="server">
    </asp:ContentPlaceHolder>
</div>

What may be the problem?

Thank you

It's written in English. Element style can't be nested within a div element.
I'd say the best way to do this is to use a placeholder for styles in <head> and insert styles there. However, if possible, I'd try to avoid such style blocks in html altogether.

And one more detail. You may be wondering why it says you can't nest it in div, when you have it in <asp:content .. element. Even though that's true, it's just a placeholder and it would end up within <div id="column2"> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM