vertical-alignment

How to vertically align an image inside a div

谁说我不能喝 提交于 2019-11-27 15:26:07
How can you align an image inside of a containing div ? Example In my example, I need to vertically center the <img> in the <div> with class ="frame ": <div class="frame" style="height: 25px;"> <img src="http://jsfiddle.net/img/logo.png" /> </div> .frame 's height is fixed and image's height is unknown. I can add new elements in .frame if that's the only solution. I'm trying to do this on Internet Explorer 7 and later, WebKit, Gecko. See the jsfiddle here . .frame { height: 25px; /* Equals maximum image height */ line-height: 25px; width: 160px; border: 1px solid red; text-align: center;

How to align a label to the “BOTTOM” of a div in CSS?

时光总嘲笑我的痴心妄想 提交于 2019-11-27 14:12:32
DEMO can be found at: http://www.bootply.com/VZ7gvA7ndE# I set the height of div to 100px and want to show the label at the bottom of the div . I use #contain-word-lab { vertical-align: bottom; margin-bottom: 5px; } However, this doesn't work at all. The label still align to the top of the div . Does anyone have any ideas about this? Why vertical-align doesn't work here? Thanks! Why vertical-align: bottom is not working alone Since the height of the parent element is greater than the computed height of the label, Using vertical-align: bottom won't move that (inline) element to the bottom of

Align top of image to top of TextView

≡放荡痞女 提交于 2019-11-27 13:26:40
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 text text text text text text text text text text text. I tried doing this by setting android:drawableLeft to my image, but that centers the image vertically: Text text text text text text text --------- text text text text text text text | Image | text text text text text text text --------- text text text text text text text text text text text text. Is this

Align text to the bottom of a div

蹲街弑〆低调 提交于 2019-11-27 11:53:20
I tried to align my text to the bottom of a div from other posts and answers in stackoverflow I learned to handle this with different css properties. But I can't get it done. Basically my html code is like this: <div style='height:200px; float:left; border:1px solid #ff0000; position:relative;'> <span style='position:absolute; bottom:0px;'>A Text</span> </div> The effect is that in FF I just get vertical line (the div in a collapsed way) and the text is written next to it. How can I prevent the div collapsing but having the width fitting to the text? Flex Solution It is perfectly fine if you

DataGrid row content vertical alignment

巧了我就是萌 提交于 2019-11-27 11:12:01
I have a regular DataGrid from WPF 4.0 RTM, where I put data from a database. In order to make clean & light style of DataGrid I use a tall/high rows and by default DataGrid aligns row content in top vertical position, but I want to set a center vertical alignment. I already tried to use this property VerticalAlignment="Center" in DataGrid options, but it doesn't help me. Here is an example of XAML-code, describing my DataGrid without center vertical alignment: <DataGrid x:Name="ContentDataGrid" Style="{StaticResource ContentDataGrid}" ItemsSource="{Binding}" RowEditEnding="ContentDataGrid

How to vertically align div inside another div without display:table-cell

♀尐吖头ヾ 提交于 2019-11-27 10:38:36
问题 Ok this is the div structure. <div class="DivParent"> <a href="#"> <div class="DivWhichNeedToBeVerticallyAligned"></div> </a> </div> DivParent has fixed width and height values but DivWhichNeedToBeVerticallyAligned does not have fixed height values. If you make DivParent display:table-cell; you can vertically align DivWhichNeedToBeVerticallyAligned but i don't want to use that feature since it causes some mess. A href tag link should be same size with the divParent i mean whole divparent has

vertical-align image in div [duplicate]

南楼画角 提交于 2019-11-27 10:36:29
This question already has an answer here: How to vertically align an image inside a div 34 answers i have problem with image vertical-align in div .img_thumb { float: left; height: 120px; margin-bottom: 5px; margin-left: 9px; position: relative; width: 147px; background-color: rgba(0, 0, 0, 0.5); border-radius: 3px; } .img_thumb img { display: block; margin-left: auto; margin-right: auto; vertical-align: middle; } <div class="img_thumb"> <a class="images_class" href="large.jpg" rel="images"><img src="small.jpg" title="img_title" alt="img_alt" /></a> </div> As far as i know i need "display:

Vertical Align Text After Font Icon

主宰稳场 提交于 2019-11-27 09:50:54
<div class="col-md-4"> <span class="fa-stack fa-2x"> <i class="fa fa-circle fa-stack-2x blue"></i> <i class="fa fa-wifi fa-stack-1x white"></i> </span> <h4 class="blue">Free wifi</h4> </div> How can I display h4 element on the right of the icon and vertically aligned? Should I float left the span ? One of the ways would be to use inline-block display and middle align it - see demo below: .wrapper > * { display: inline-block; vertical-align: middle; } .blue { color: blue; } .white { color: white; } <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel=

Pin a flex item to the bottom of the container

不羁的心 提交于 2019-11-27 09:36:41
I have 4 blocks with a title, description and a button. I want to keep Title and Description aligned on top, and the Button to be aligned on bottom no matter how long the description or title is. I also need to keep the same HTML structure. Sample picture of what I actually need: Can somebody figure it out? I didn't find a fix on internet so far. /* FLEXBOX RELATED */ .grid { display: flex; justify-content: space-between; flex-flow: row wrap; } .block { flex: 0 24%; display: flex; } .container { display: flex; flex-flow: row wrap; align-items: flex-start; } .title { flex: 0 100%; } .desc {

CSS Vertical align does not work with float

老子叫甜甜 提交于 2019-11-27 08:48:12
How can I use the vertical-align as well as float in the div properties? The vertical-align works fine if I do not use the float . But if I use the float, then it does not work. It is important for me to use the float:right for the last div. I am trying following, if you remove the float from all div's then it would work fine: <div class="wrap"> <div class="left">First div, float left, has more text.</div> <div class="left2">Second div, float left </div> <div class="right">Third div, float right</div> </div> CSS: .wrap{ width: 500px; overflow:hidden; background: pink; } .left { width: 150px;