vertical-alignment

CSS - Center align text with icon

谁说我不能喝 提交于 2019-11-28 11:32:49
Using material icons with CSS, I have the following code that renders a link with icon and text. <a href="#"><i class="material-icons">group_work</i>Groups</a> As you can see in the image below, the text seems to be sinking down.. I would like them to be vertically aligned center together. How can i achieve this? PS. (Not a designer!) To vertically center elements, you can use the vertical-algin: middle; rule. In your case, that would most propably be: .material-icons { vertical-align: middle; } Here is an example with your dark button: .material-icons { vertical-align: middle; margin-right:

How to position child div to the center of every parents div using position absolute in css [duplicate]

我只是一个虾纸丫 提交于 2019-11-28 10:37:55
问题 This question already has an answer here: How to center absolutely positioned element in div? 33 answers I'm having difficulty on positioning child div's on every parents div. Here's the css code: .mainDiv { height:500px; position: relative; } .mainDiv .parent1 { height: 250px; background-color: blue; top: 50px; position: relative; } .mainDiv .parent2 { height: 250px; background-color: yellow; position: relative; } .mainDiv .parent1 .sub1 { width: 100px; height: 100px; background-color: green

How to align these buttons in a row? [duplicate]

夙愿已清 提交于 2019-11-28 08:36:06
问题 This question already has answers here : Align inline-block DIVs to top of container element (4 answers) Why is this inline-block element pushed downward? (8 answers) Closed 7 months ago . https://jsfiddle.net/2L9mznzu/ There are two empty text button, how to align them into a row? .button { display: inline-block; width: 80px; height: 30px; line-height: 30px; background: gray; margin: 0 4px; text-align: center; } <div class="button"> </div> <div class="button">Button </div> <div class="button

Vertically centering text within an inline-block

杀马特。学长 韩版系。学妹 提交于 2019-11-28 08:08:27
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 Safari but not in Internet Explorer so I'm thinking I need to stick to inline-block. How would I go

Vertical Align - List with “list-style-image”

走远了吗. 提交于 2019-11-28 08:01:14
问题 Neither googling nor browsing in SO helped me - hope someone here can solve this : I have the following html : <ul> <li>ABC 1</li> <li>ABC 2</li> <li>ABC 3</li> <li>ABC 4</li> </ul> and css ul {list-style-image:url(../img/hook.png);} li {vertical-align:middle;color:#FFFFFF;font-size:16px;text-shadow: 0em 0.13em 0.13em #2A2A2A;font-family:Helvetica,Arial,Sans-Serif;font-weight:normal;} the "hook.png" image is 32x35 px - but whenever I create list items, text (e.g. ABC...) will always be shown

Vertical align an image and a multiline text

。_饼干妹妹 提交于 2019-11-28 07:18:00
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: 8px;" src="images/arrow_black.png" /> <span style="display: inline-block; vertical-align: middle;">

How to make text run top-to-bottom in CSS?

≡放荡痞女 提交于 2019-11-28 07:17:55
问题 Does anyone know how to make text align top-to-bottom in a div. SO won't even let me demonstrate it . . . I just want the letters to stack on top of each other in a vertical line down the page like the stories of a building. Was hoping I didn't need to do it with an image. 回答1: To make the letters top-to-bottom while keeping their normal orientation, like this: F O O HTML: <div class="toptobottom">letters</div> CSS: .toptobottom{ width: 0; word-wrap: break-word; } word-wrap allows words to be

Vertically center content of floating div

不羁的心 提交于 2019-11-28 06:24:05
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: table-cell and it didn't work either. What's the best way to solve this issue? I'd like to avoid

Vertically center text in UILabel depending on actual visible letter height

三世轮回 提交于 2019-11-28 06:06:10
问题 How can I vertically center a single letter in a UILabel considering the actual visible size of the letter, not the font size. For example, I need letters 'f' and 'o' to be exactly in the middle of the label. I have tried to render the label to an image, crop the transparent pixels and then set the center of the UIImageView BUT it always appears slightly more blurry than the actual label. How can this be achieved? Thanks in advance. 回答1: I think you need to delve into core text to get the

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

非 Y 不嫁゛ 提交于 2019-11-28 04:54:45
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> <a href="#section-4">Section 4</a> <a href="#section-5">Section 5</a> </nav> I use kswedberg's jQuery