vertical-alignment

How to align text vertically?

安稳与你 提交于 2019-12-02 04:22:54
What is the easiest way to align the text vertically here with CSS ? <ul> <li>Hello</li> <li>Bye Bye</li> <li>Ciao</li> </ul> li { border: 1px solid black; width: 100px; height: 50px; margin-bottom: 20px; text-align: center; } If you have just one line of text, you can set the line-height to the same value as the height . This works for any element. Hacky, but possibly the easiest way: li { display: table-cell; vertical-align: center; } You will need to add a background image in place of the list item bullet. If you know you're always going to center a single line you could match height and

How to align two columns of text in CSS

我怕爱的太早我们不能终老 提交于 2019-12-02 01:07:11
I'm having some trouble lining up some text. I need two columns, one with numbers and one with text, like so: 1 Entry one 2 Entry two 3 Entry three 4 Entry five 5 Entry six The left column is Georgia and the right column is Arial (slightly different font sizes). I could have a container div for each row and absolutely position the number and text paragraphs to be at the top or bottom of these, which works fine. The problem is this means I have to give each row a fixed height so that it displays properly, which causes a problem if the text needs to flow onto more than one line (which it may

Vertical text in a Horizontal UIButton

我与影子孤独终老i 提交于 2019-12-02 00:54:06
I'm using a vertical UIButton in a portrait app (Just a normal button that is of width 60 and Height 160) I want to put the label Vetically down the button instead of across it. When I use the following code to rotate the label [workPackageButton.titleLabel setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; It rotates the label but the length seems to be constrained by the original width, so I get the ... abreviation in the middle. Is there an easy way round this? You can add a Label on button and rotate the label as below: UILabel *lbl= [[UILabel alloc] initWithFrame:CGRectMake(button

SpriteKit: Is there a way to centre a SKLabelNode according to its baseline

一世执手 提交于 2019-12-02 00:37:54
A label has four different verticalAlignmentMode : .Baseline , .Bottom , .Center and .Top . I would like the label to be centred on its position according to its baseline. .Center doesn't work for me because the bottom of the frame isn't the baseline of the text, but rather, the bottom of the lowest letter (like a 'y', for example). I have also tried using .Baseline and subtracting half the frame's height from the y-position, but this doesn't work either and results in the same problem as .Center . The text in the label I'm trying to centre is "Play!". Setting the mode to '.Center' makes the

How to remove space at top of <p> tag / align contained text to top of container?

心已入冬 提交于 2019-12-01 20:42:31
This is undoubtedly a stupid question but i'm having a bad day and it's confusing me! If you view http://jsfiddle.net/E6kGP/1/ then you can see 2 simple divs next to each other each of which contains a p tag each with different font sizes and matching line-heights. There is a small gap between the top of the p container and the top of the contained text which is different depending on the font sizes (and line-heights). This means that the top of the text in each p is not vertically aligned. If the line-heights didn't match the font-sizes then I could understand this but surely if they are the

<ul> horizontal nav bar… vertically-align element

北慕城南 提交于 2019-12-01 18:50:44
问题 I currently have the following code. I am trying to get the second, third, and fourth "li" elements to vertically-align in the middle of the nav bar. The first "li" is an image, and the second-fourth are all text. Here is a screenshot of it currently. http://i49.tinypic.com/bfesl3.png I have tried using "vertical-align:middle" and padding. Note that the second, third and fourth "li" elements appear vertically-aligned in the middle if viewed in Firefox but not in other browsers. Here is the

<ul> horizontal nav bar… vertically-align element

自闭症网瘾萝莉.ら 提交于 2019-12-01 18:19:22
I currently have the following code. I am trying to get the second, third, and fourth "li" elements to vertically-align in the middle of the nav bar. The first "li" is an image, and the second-fourth are all text. Here is a screenshot of it currently. http://i49.tinypic.com/bfesl3.png I have tried using "vertical-align:middle" and padding. Note that the second, third and fourth "li" elements appear vertically-aligned in the middle if viewed in Firefox but not in other browsers. Here is the code I have. <ul class = "nav"> <li><a href="index.html" style="border-right:1px #FFFFFF solid; padding

Unable to vertically align text in table cell with itextsharp

只愿长相守 提交于 2019-12-01 18:13:19
问题 I can not figure out how to vertically align text in table cell. horizontal alignment is ok. I use itextsharp to generate pdf. Alignment should be applied to cells in table kitosKalbosTable. Any help would be appreciated. here's my code: var table = new PdfPTable(new float[] { 36, 1, 63 }); table.WidthPercentage = 100.0f; table.HorizontalAlignment = Element.ALIGN_LEFT; table.DefaultCell.Border = Rectangle.NO_BORDER; table.SplitRows = false; ......... PdfPTable kitosKalbosTable = new PdfPTable

Set VerticalAlignment in DrawText

纵饮孤独 提交于 2019-12-01 18:00:21
I'm using DrawText to draw FormattedText on Visual Layer. Now I'm using the code below to define the formatted text and I'm able to set the TextAlignment to Center . But what about the VerticalAlignment ? As you can see in the image below the center of the text is not on the centerpoint which is shown with a red dot here. The part where I'm defining the FormattedText : var ft = new FormattedText("A", CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, new Typeface("Verdana"), 36, Brushes.Yellow); ft.TextAlignment = TextAlignment.Center; The part where I'm drawing the text: var

Unable to vertically align text in table cell with itextsharp

随声附和 提交于 2019-12-01 17:44:43
I can not figure out how to vertically align text in table cell. horizontal alignment is ok. I use itextsharp to generate pdf. Alignment should be applied to cells in table kitosKalbosTable. Any help would be appreciated. here's my code: var table = new PdfPTable(new float[] { 36, 1, 63 }); table.WidthPercentage = 100.0f; table.HorizontalAlignment = Element.ALIGN_LEFT; table.DefaultCell.Border = Rectangle.NO_BORDER; table.SplitRows = false; ......... PdfPTable kitosKalbosTable = new PdfPTable(new float[] {10, 30}); kitosKalbosTable.TotalWidth = 40f; kitosKalbosTable.SplitRows = false;