vertical-alignment

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

蹲街弑〆低调 提交于 2019-11-27 02:46:01
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 text to be vertically centered in the cell. There is an internal flag in NSTextFieldCell that can be used to vertically center the text, and it works beautifully. However, since it is an internal flag, its use is not sanctioned by Apple and it could simply disappear without warning in a future release. I am currently using this internal flag

Vertically centering text within an inline-block

前提是你 提交于 2019-11-27 02:05:30
问题 I'm trying to create some buttons for a website using styled hyperlinks. I have managed to get the button looking how I want, bar one slight issue. I can't get the text ('Link' in the source code below) to vertically center. Unfortunately there may be more than one line of text as demonstrated with the second button so I can't use line-height to vertically center it. My initial solution was to use display: table-cell; rather than inline-block , and that sorts the issue in Chrome, Firefox and

Vertical align an image and a multiline text

让人想犯罪 __ 提交于 2019-11-27 01:47:14
问题 I´m trying to align an image and a text vertically: +-------------------------+ -- Viewport | Text text text | | +-----+ text text text | | |IMAGE| text text text | | +-----+ text text text | | text text text | +-------------------------+ This works fine, if the text is not wrapped. If the Text is wider than the viewport-width, it does not work anymore. I think this is caused by setting display: inline-block: <a href="#"> <img style="display: inline-block; vertical-align: middle; margin-right

Vertically center content of floating div

廉价感情. 提交于 2019-11-27 01:19:33
问题 How do I verically center the content of floating div (which height I don't know)? There is very simple HTML and CSS (see this fiddle: http://jsfiddle.net/DeH6E/1/) <div class="floating"> This should be in the middle </div> ​ .floating { height: 100px; float: left; border: 1px solid red; vertical-align: middle; } ​ How do I make the sentence "This should be in the middle" appear really in the middle (vertically centered)? vertical-align: middle does not seem to work. I have tried display:

Vertical-align image

可紊 提交于 2019-11-27 01:08:00
I have a div that contains an image and a p tag (seen below). I want to align the image in the middle of the div vertically depending on how many lines the paragraph is. Vertical-align doesn't work. I am using JavaScript right now to figure out how much to add to margin-top, but would rather use CSS. Any ideas? <div> <img> <p>Multi-line</p> </div> Try setting the line-height attribute of the p element to the height of the image, eg: div p { line-height: 18px; } Edit: Just realised I misread the question and missed the fact the p would be multi-line. One option to try is removing the img

iOS 7 UITextView vertical alignment

痞子三分冷 提交于 2019-11-27 01:00:57
How is that possible that my editable UITextView (placed inside a straightforward UIViewController inside a UISplitView that acts as delegate for the UITextView ) is not showing text from the beginning but after something like 6-7 lines? I didn't set any particular autolayout or something similar, trying to delete text doesn't help (so no hidden chars or something). I'm using iOS 7 on iPad, in storyboard looks good... The problem is the same on iOS simulator and real devices. I'm getting mad :P Here's some code. This is the ViewController viewDidLoad() - (void)viewDidLoad { [super viewDidLoad]

How to vertically align Bootstrap v4 modal dialogs

大城市里の小女人 提交于 2019-11-27 00:55:46
问题 Vertically center modal dialogues in Bootstrap 4. Note: The requirements below have been added to make it clear I am looking for a proper way to vertically center a Bootstrap modal, covering all possible cases, on all possible devices, in all browsers. In my case, I wanted it for a large SPA reusing the same modal throughout the app so I needed it to work in each case. It should: keep modal contents accessible, on all devices, even when taller than device height work on any device+browser

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

倖福魔咒の 提交于 2019-11-27 00:42:33
问题 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. Instead, I want to align the element to the middle of the screen. I use this markup for navigation: <nav class="main-nav"> <a href="#top">Top</a> <a href="#section-1">Section 1</a> <a href="#section-2">Section 2</a> <a href="#section-3">Section 3</a>

I want to vertical-align text in select box

不想你离开。 提交于 2019-11-27 00:25:31
I want to vertically align the text in select box. I tried using select{ verticle-align:middle; } however it does not work in any browsers. Chrome seems to align the text in select box to the center as a default. FF aligns it to the top and IE aligns it to the bottom. Is there any way to achieve this? I am using GWT's Select widget in UIBinder. This is currently what I have: select{ height: 28px !important; border: 1px solid #ABADB3; margin: 0; padding: 0; vertical-align: middle; } Thanks! user401183 Your best option will probably be to adjust the top padding & compare across browsers. It's

Vertically center rotated text with CSS

我们两清 提交于 2019-11-26 23:59:54
问题 I have the following HTML: <div class="outer"> <div class="inner rotate">Centered?</div> </div> div.outer is a narrow vertical strip. div.inner is rotated 90 degrees. I would like the text "Centered?" to appear centered in its container div. I do not know the size of either div in advance. This comes close: http://jsfiddle.net/CCMyf/2/. You can see from the jsfiddle that the text is vertically centered before the transform: rotate(-90deg) style is applied, but is somewhat offset after. This