SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Center text in div
-
Jul 3, 2006, 15:34 #1
- Join Date
- Dec 2002
- Location
- Canada
- Posts
- 2,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Center text in div
if I have a div of width and height 150, how do I get the text centered vertically and horizontally? I can't get it working!
AskItOnline.com - Need answers? Ask it online.
Create powerful online surveys with ease in minutes!
Sign up for your FREE account today!
Follow us on Twitter
-
Jul 3, 2006, 15:38 #2
- Join Date
- Jul 2005
- Location
- Middle England
- Posts
- 3,417
- Mentioned
- 3 Post(s)
- Tagged
- 0 Thread(s)
Add this to the DIV's css to center
text-align: center;
Aligning middle is hard to to in CSS but there are several ways - Google search results
-
Jul 3, 2006, 16:19 #3
- Join Date
- Nov 2005
- Location
- Trinidad
- Posts
- 3,746
- Mentioned
- 45 Post(s)
- Tagged
- 0 Thread(s)
Sometimes changing the div's display to "table-cell" forces the centering to work.
div{display:table-cell;}
Bookmarks