• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

Page not picking up css class

Hi there I have an ASP.NET page in which I have various <div> tags controllling the layout of my controls.

My problem is that if I do the following:
<div align="left">
</div>

My divs are left aligned as I would expect them to be however I don't want to explicitly define the alignment as I may want to change it so instead I want to use a class so I can amend all tags in one place
so I have defined a class as follows:
div.myclass
{
    align:left;
}
 
then have my <div> tags look like <div class="myclass">blah</div> but this doesn't work.
Can anyone tell me how I define the alignment correctly in a css class.

Thanks
Sam
0
Samm1502
Asked:
Samm1502
1 Solution
 
Ivo StoykovCommented:
try
div.myclass
{
  text-align: left;  
}

0
 
zstapicCommented:
Your problem is simple, just do the following:
in HTML:

<div id='myCoolDiv'> </div>

And in the css:
#myCoolDiv{   border: 1px solid green;}

That should do it.
Here is the deal, when you use the class tag in HTML your css class must start with ".", in this example it would be .myCoolDiv and if you use id tag, then you use the #.
0
 
Samm1502Author Commented:
This worked - many thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now