Help with CSS and Div Runat server

I have a <div> tag on my page that uses a CSS ID class to position itself and sets some text and background color attributes.  

Here's my problem.  If I load the page without the "runat" it loads with the correct CSS properties.  However, if I add the runat="server" to the div tag the CSS properties do not get applied to the div tag?

I need to add the runat because I want to control the divs visibility from the code behind.

So basically, this loads the CSS properties....

<div id="testPop">This is my div!.</div>

And this doesn't....

<div id="testPop" runat="server">This is my div!.</div>

What am I missing?  The page uses a masterpage so could that be the problem.  The CSS file is called in the masterpage.
#testPop 
{
     position:absolute;
     top:150px;
     right:500px;
     width:400px;
     background-color:Aqua;
     padding: 20px;
}

Open in new window

cdemott33Asked:
Who is Participating?
 
MikeMCSDCommented:
.testPop
{
     position:absolute;
     top:150px;
     .....

<div id="testPop" style="testPop"></div>
0
 
MikeMCSDCommented:
use style instead:

<div id="testPop" style="styleName"></div>
0
 
cdemott33Author Commented:
It worked!  I'm not sure why but it worked?  What's the difference between the ID and the STYLE?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
cdaly33Commented:
Here's what you need.  Just change the type of jquery animation to whichever kind you want.
http://www.dennydotnet.com/post/Animating-ASPNET-AJAX-Update-Panel-Updates.aspx
0
 
MikeMCSDCommented:
What's the difference between the ID and the STYLE?

The ID can only be used on one element/tag.
The style can be used on many elements.
0
 
cdemott33Author Commented:
MikeMSCD - Understood but I'm still confussed.  Why can't I use an ID selectors?  Why must I use a style selector?  In my case (in my head anyway) it should not matter.  Ok, yes, I can only use it on one element, but what if that's all I want to use it for... one element.

I'm just trying to get my head around this one, because to me, it shouldn't matter.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.