By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

why is style = "text-align: center;" not working

Claus Mygind
100+
P: 571
I am trying to update my code and came across this problem. The old code as shown here does great in centering the text as shown in photo 1

I simply use "align='center'"
Expand|Select|Wrap|Line Numbers
  1. <div 
  2.     id   ="popSearch"  
  3.     align="center"
  4.     style="position:fixed; 
  5.             visibility:hidden; 
  6.             z-index:99;" 
  7.     <form  
  8.         method="POST"  
  9.         enctype="application/x-www-form-urlencoded" 
  10.     > 
  11.         <table 
  12.             name = "popSTable" 
  13.             id   = "popSTable" 
  14.         > 
  15.             <tbody id="searchData" > 
  16.             </tbody> 
  17.         </table>             
  18.     </form> 
  19. </div> 
  20.  




However when I switch the code to using style, my text no longer centers as shown in the code below and shown in photo 2.

Here is use "style = 'text-align:center;'"
Expand|Select|Wrap|Line Numbers
  1. <div 
  2.     id   ="popSearch"  
  3.     style=" text-align:center;
  4.             position:fixed; 
  5.             visibility:hidden; 
  6.             z-index:99;" 
  7.     <form  
  8.         method="POST"  
  9.         enctype="application/x-www-form-urlencoded" 
  10.     > 
  11.         <table 
  12.             name = "popSTable" 
  13.             id   = "popSTable" 
  14.         > 
  15.             <tbody id="searchData" > 
  16.             </tbody> 
  17.         </table>             
  18.     </form> 
  19. </div> 
  20.  



I have also tried applying the style code to the form, table and tbody tags and none of them work. Not sure why that is so.
Aug 22 '11 #1

✓ answered by Dormilich

you can check in Firebug, where your CSS rule is overwritten (i.e. FB shows you the style cascade)

Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
you can check in Firebug, where your CSS rule is overwritten (i.e. FB shows you the style cascade)
Aug 22 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.