vertical-alignment

How to vertically align image and text in table cell?

时间秒杀一切 提交于 2020-01-01 14:57:01
问题 I'm trying to get the text to be on the right side and vertically center aligned with the image. How can I do that? My current code: <div style="display: table;"> <div style="display: table-cell;"><img src="//dummyimage.com/100"></div> <div style="display: table-cell;">text</div> </div> 回答1: use CSS3 Flexible Box Layout: from the documentation: providing for the arrangement of elements on a page such that the elements behave predictably when the page layout must accommodate different screen

Vertically align content of Bootstrap 3 column

落爺英雄遲暮 提交于 2020-01-01 04:16:05
问题 After coming back to web-development after a four year hiatus, I am having a tough time vertically aligning the contents of a bootstrap 3 column with the next column. I have tried searching this site as well as generic searches in general and have just not come up with the right solution ... or my search terms are poor. In the HTML/CSS below, I would like to vertically center the "Page Title" text in the left column. I would like to keep the HTML and CSS as concise as possible while using the

How does line-height vertically center text?

烈酒焚心 提交于 2020-01-01 04:12:46
问题 I'm trying to understand why the line-height CSS property places the text vertically in the middle of this button: .btn-order { width: 220px; height: 58px; font-size: 24px; padding: 0; text-align: center; vertical-align: middle; line-height: 58px; border: 1px solid black; } <div class="btn-order">Complete Order</div> 回答1: The line-height property is essentially setting a 29px (29 + 29 = 58) text line above and below your text, "Complete Order". If you added another line of text below this you

How does line-height vertically center text?

非 Y 不嫁゛ 提交于 2020-01-01 04:12:05
问题 I'm trying to understand why the line-height CSS property places the text vertically in the middle of this button: .btn-order { width: 220px; height: 58px; font-size: 24px; padding: 0; text-align: center; vertical-align: middle; line-height: 58px; border: 1px solid black; } <div class="btn-order">Complete Order</div> 回答1: The line-height property is essentially setting a 29px (29 + 29 = 58) text line above and below your text, "Complete Order". If you added another line of text below this you

iTextsharp, PdfPCell.VerticalAlignment and PdfPCell.HorizontalAlignment

♀尐吖头ヾ 提交于 2019-12-31 17:51:40
问题 Im trying to figure out how to get my text inside a PdfPCell to show in the middle. I have tried many different options, like: myCell.VerticalAlignment = Element.ALIGN_MIDDLE; myCell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; myCell.VerticalAlignment = Rectangle.ALIGN_MIDDLE; None of that works for me. VerticalAlignment takes an int, so I tried to make a loop, to see if i could find the right number, but everything just get left bottom align.. Document myDocument = new Document(PageSize.A4);

Bootstrap: align elements to bottom of column

﹥>﹥吖頭↗ 提交于 2019-12-31 05:28:09
问题 To explain it in a short way, this is what I'm trying to achieve: http://www.bootply.com/Muh7eahFC8# A responsive design, with three columns, and a button at the bottom of each column. The problem is that I'm setting the height of the columns manually, and I'd like the whole thing to automatically adapt to the longest content of the three column. Right now, I'm setting a different height based on the size of each viewport: @media only screen and (min-width : 992px) { div { height: 180px; }

Vertical align span text inside inline-block div

戏子无情 提交于 2019-12-30 02:14:07
问题 I am building a website with a flat design. I have a header and under it two different coloured blocks next to each other. I tried float left and right but was advised to use display: inline-block instead. I ran into an issue, though. I want to place some text right in the middle of both the left and right block and tried to use the align-items: center, but figured out that only works if the div is set to flex. So my question is, can I somehow keep my inline-block and get my text centered in

How to vertically align an image in unknown size to the center of a div?

南笙酒味 提交于 2019-12-30 02:11:10
问题 I have a simple HTML button which contains text and an image: HTML: (Already on http://jsfiddle.net/EFwgN) <span class="Button"> <img src="http://www.connectedtext.com/Image/ok.gif" /> Small Icon </span> CSS: span.Button {display:inline-block; margin:2px 4px;padding:3px 6px; background-color:#ddd; height:24px; line-height:24px; vertical-align:middle;} span.Button img {vertical-align:middle;} I can't come up with a combination that would fit these requirements: The image and text need to be

CSS metaphysics: WHY is page vertical alignment so difficult?

本秂侑毒 提交于 2019-12-28 05:35:58
问题 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? Why isn't there margin:auto 0 ? I mean, from a programming perspective. Theoretically, it seems like the same algorithms would apply to both types of centering. 回答1: Good question and I don't know, but I would suspect the root of the problem is going

Flex items not centering vertically

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-28 04:34:06
问题 I'm trying to center vertically the content with flex boxes without success. I don't like to use position or translate because it is not a fixed size. What is wrong with my code? .row-centered { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; } .col-centered { display: flex; flex-direction: column; align-self: flex-start; float: none; margin-right: 0 auto; } .us-container{ display: flex; justify-content: center; align-items: center; vertical-align: middle; resize