| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Vertically Aligning text in a DD | |
|---|---|
| Tweet Topic Started: Jul 28 2014, 10:32 AM (669 Views) | |
| Ferby | Jul 28 2014, 10:32 AM Post #1 |
![]()
Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I'm tweaking a theme of mine but I can't vertically align text in a DD element. I'm looking for it to be in the middle, not the top. Can anyone lend a hand?Thanks to anyone that can help
|
![]() |
|
| Meta Ing-ZNR | Jul 28 2014, 01:02 PM Post #2 |
|
---
![]() ![]() ![]() ![]() ![]() ![]()
|
The vertical-align property is meant to vertically-align inline content within a line. (e.g., a small image like an emoticon). With a few exceptions (namely, table cells, headers, and rows), it does nothing to vertically align content within a container, however. One way to vertically center content within a container, when you know both the height of the container (which you do - 30px), and how many lines will be in the container (probably one), is to add a line-height equal to the height divided by the number of lines*. So, in your case, adding line-height:30px; should do the trick. * Note that other adjustments may be needed when you have uneven top and bottom paddings Edited by Meta Ing-ZNR, Jul 28 2014, 01:03 PM.
|
![]() |
|
| Ferby | Jul 28 2014, 06:37 PM Post #3 |
![]()
Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Ah, that's new to me (not line-height: using it to vertically align). I'll give it a shot
Edited by Ferby, Jul 28 2014, 06:39 PM.
|
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · ZetaBoards - Theme & Code Support · Next Topic » |






![]](http://z1.ifrm.com/static/1/pip_r.png)



10:09 AM Jul 11