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
Samm1502Asked:
Who is Participating?
 
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
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.