Click here to Skip to main content
13,410,463 members (37,574 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
hi all
How To set Div content in Middle Position?
Posted 21-Sep-12 4:53am
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?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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

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:

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


http://bluerobot.com/web/css/center1.html[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Try this

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.180221.1 | Last Updated 27 Sep 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100