Questions tagged [vertical-alignment]

Typically a style or other UI definition associated with the placement of an interface item in the vertical plane.

3043 questions
52
votes
7 answers

Is there a "right" way to have NSTextFieldCell draw vertically centered text?

I have an NSTableView with several text columns. By default, the dataCell for these columns is an instance of Apple's NSTextFieldCell class, which does all kinds of wonderful things, but it draws text aligned with the top of the cell, and I want the…
e.James
  • 109,080
  • 38
  • 170
  • 208
51
votes
11 answers

Vertical align all(!) elements in TD?

I have a simple table with 1 TD with vertical-align:middle;. This TD contains an Image : table { border:solid 1px red; width:300px; } td { height:100px; vertical-align:middle; width:100%; border:solid 1px green; } img { …
Royi Namir
  • 131,490
  • 121
  • 408
  • 714
50
votes
2 answers

How to vertically align floating divs to the bottom?

Because examples rule: http://jsfiddle.net/rudiedirkx/wgue7/ How do I get the bars to the bottom instead of the top? Now they're sticking to the top of the container (#bars) but I want them sticking to the bottom. As you can see, I don't know the…
Rudie
  • 46,504
  • 37
  • 126
  • 167
47
votes
3 answers

How to vertically middle-align floating elements of unknown heights?

I have a (horizontally) centered outer div containing two elements of unknown width:
...
...
Both floats are top-aligned by default,…
Yang
  • 15,052
  • 13
  • 96
  • 137
46
votes
7 answers

Vertically aligning a checkbox

I have looked at the different questions regarding this issue, but couldn't find anything that works due to limitations in my markup. My markup looks like so (unfortunately as this is generated by some backend, I am unable to change the…
F21
  • 28,366
  • 23
  • 91
  • 157
45
votes
9 answers

CSS: Vertically align div when no fixed size of the div is known

How do I align a
which contains an image (or flash) vertically with CSS. Height and width are dynamic.
Oleg Tarasenko
  • 8,244
  • 17
  • 64
  • 97
45
votes
2 answers

CSS metaphysics: WHY is page vertical alignment so difficult?

Relative to the page, horizontal alignment in CSS is easy - a margin:0 auto gets you by much of the time, and a text-align:center for some other cases. My question to the gurus is not how to vertically align, but why is it so much more difficult? …
Ben
  • 47,286
  • 44
  • 159
  • 208
44
votes
1 answer

UITextField Vertical Alignment

Is there a way to vertically align text in a UITextField half-way between UIControlContentVerticalAlignmentCenter and UIControlContentVerticalAlignmentBottom or do I have to go with one of those?
Matt Winters
  • 1,089
  • 2
  • 12
  • 22
42
votes
7 answers

Center a H1 tag inside a DIV

I have the following DIV inside a body tag:

Yes

And these are their CSS classes: #AlertDiv { position:absolute; height: 51px; left: 365px; top: 198px; width: 62px; background-color:black; …
VansFannel
  • 41,682
  • 96
  • 329
  • 561
42
votes
6 answers

HTML-CSS Center Text horizontally and vertically in a link

I am trying to make a link which has a height and a width of 200px. The text of the link shall be centered vertically and horizontally. This is my CSS so far: a:link.Kachel { width: 200px; height: 200px; margin: 0 auto; display: block; …
user1567896
  • 2,278
  • 2
  • 23
  • 43
42
votes
6 answers

Align top of image to top of TextView

I want to create a layout that aligns the top of an image to the top of a TextView like this: --------- Text text text text text text text | Image | text text text text text text text --------- text text text text text text text text…
Claes
  • 683
  • 1
  • 6
  • 9
37
votes
4 answers

Vertically centering a title page

I'm trying to vertically center a title on a custom-sized page with latex. I've written the following code, but for some reason it doesn't center. Could someone please point me to what's wrong with it? Thanks!…
Clément
  • 10,212
  • 13
  • 62
  • 104
37
votes
5 answers

jQuery - Scroll element to the middle of the screen instead of to the top with an anchor link

I'm building a one-page site with a fixed-positioned navigation bar which scrolls smoothly to the different section elements through anchor links. The default behaviour for scrolling to an element is to align it to the top of the browser window.…
34
votes
4 answers

Vertical-align: bottom not working

I thought vertical-align was supposed to work with inline elements. Yet for some reason everything in the gray div is aligned to the top, not the bottom.
Adam Rackis
  • 79,454
  • 49
  • 255
  • 377
34
votes
3 answers

What's the deal with vertical-align: baseline?

I thought I knew my way around CSS, but I needed to explain something to someone just now and I found I couldn't. My question basically boils down to: why is vertical-align:baseline ignored when there are other alignments in the same line? Example:…
Mr Lister
  • 42,557
  • 14
  • 95
  • 136