Weird rendering behaviour in SharePoint with self-closing DIV tags

I was doing branding in SharePoint 2010 and noticed that SharePoint will render elements declared after a self-closing DIV as children of that DIV. So, if my master page has something like this:

<div style="float: left">Hi world</div>
<div style="clear: both"/>
<div>new section</div>

The page will be rendered as:

<div style="float: left">Hi world</div>
<div style="clear: both">
   <div>new section</div>

Changing the clear DIV to be <div style=”clear: both”></div> and the page rendered as expected.

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in Branding, SharePoint. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s