Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all
How To set Div content in Middle Position?
Posted
Comments
Zoltán Zörgő 27-Sep-12 7:48am    
Middle is a synonym of "vertically centered" when used with images. But it does not work like that whit divs. You want vertically centering, horizontally centering or both?

It depends what you mean. If you want to center the content of a div, the css rule is:

CSS
text-align:center;


http://www.w3schools.com/cssref/pr_text_text-align.asp[^]

if you want the div to center itself I think the rule is:

CSS
margin-left:auto;
margin-right:auto;


http://bluerobot.com/web/css/center1.html[^]
 
Share this answer
 
Try this

<div align="center" width="100%"> Content will be displayed in center</div>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900