Mike
Mike

Reputation: 21

ASP.NET Menu control automatically adding inline style

I'm using VS 2010 and the ASP.NET Menu control is adding the following inline style:

style="float: left;"

I added the following to the control's declaration:

IncludeStyleBlock="false" CssClass="myClass" style=""

without success. Is there a trick to get this control to NOT add styling?


The menu is rendering as such:

<div class="myMenu" style="float: left;" >
<ul id="menu" style="float: left ....

</div>

The top level div doesn't need to float. I'm not sure how to fix this.

Upvotes: 2

Views: 2199

Answers (2)

antoniosanct
antoniosanct

Reputation: 38

Using inline styles overwrites behaviour of other css defined styles. The solution that I used was jQuery:

$("<DIV> id").removeAttr("style");
$("<UL> class").removeAttr("style");
$("<UL> class").find("li").removeAttr("style");

Regards!

Upvotes: 0

Joe Enos
Joe Enos

Reputation: 40403

The float:left is what is making the menu items appear side-by-side. Is this not what you want?

If you really want it gone, you can try modifying your css:

.myClass { float: none !important; }

Upvotes: 4

Related Questions