Vertical align in css
Vertical align in css
I have an html: css: how do i get the text to stay in the middle of the P.S. i have a gradient background on the cheer, Fraser Add text-align: center; to the div or the li. Make the line-height the same value as the height. The font size should be smaller than the height. If you want to use a gradient for a background, you could try the CSS way; check out the fiddle... http://jsfiddle.net/UnsungHero97/F5FEg/1/ Instead, if you want to use an image, it shouldn't affect how the text is positioned since this is a "background" image. If you do get some weird positioning, update your question and show us exactly what the problem is with code/screenshots/fiddle. Give it a Vertical alignment is a tricky business. Take a look at this article on getting a better understanding on how to http://phrogz.net/CSS/vertical-align/index.html I hope this helps. The magic is to use simulate a table layout with css I like Hristos answer a lot =) Heres another solution: If you set the height and width of the div you can use the vertical -align property. In the Div is text, the size of that text changes.
#about_nav li{ height:48px; width:130px; margin-bottom:15px; } #about_nav li div{ text-align:right; margin-right:10px; vertical-align:middle; }
?
but i removed it because it is bulky.
Answer by theduke for Vertical align in css
Answer by Homer6 for Vertical align in css
Answer by Hristo for Vertical align in css
UPDATE
line-height
as tall as the ...
#about_nav li div{ text-align:right; margin-right:10px; line-height: 48px; /* as tall as the li */ }
vertical-align
works and how to align things vertically in general...
HristoAnswer by armonge for Vertical align in css
#about_nav li{ height:48px; width:130px; margin-bottom:15px; display:table-row; } #about_nav li div{ text-align:right; margin-right:10px; vertical-align:middle; display:table-cell; }
Answer by LostLin for Vertical align in css
#about_nav li{ height:48px; width:130px; margin-bottom:15px; border:1px solid; } #about_nav li div{ height:inherit; width:inherit; padding-right:10px; display: table-cell; text-align:right; vertical-align: middle; border:1px solid; }
See an Example: http://jsfiddle.net/3asEN/
Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72
0 comments:
Post a Comment