center

Set height of CSS flex elements to the same amount?

丶灬走出姿态 提交于 2019-12-23 11:32:56
问题 I have 2 divs next to each other that I center vertically and horizontally using flex and justify-content/align-items. Example HTML: <div class="inner"> <div class="section green"> <img src="http://i.imgur.com/hEOMgVf.png"> </div> <div class="section red"> <img src="http://i.imgur.com/nEybO1g.png"> </div> </div> CSS: .inner { float: left; width: 500px; display: flex; justify-content: center; align-items: center; background-color: #343434; text-align: center; } .section { float: left; flex: 1;

How to put activityindicator middle of a tableview

混江龙づ霸主 提交于 2019-12-23 10:17:02
问题 I have put activity indicator spinner.center = CGPointMake( [UIScreen mainScreen].bounds.size.width/2,[UIScreen mainScreen].bounds.size.height/2); [self.view addSubview:spinner]; But this is not properly centered in the table view. Because table view can scroll. How can i put a spinner in the center of the screen. 回答1: try with bellow code:- spinner.center = CGPointMake( [UIScreen mainScreen].bounds.size.width/2,[UIScreen mainScreen].bounds.size.height/2); yourAppdelegateClass *appDelegate =

How to set centers of shapes/fixtures/bodies in Box2D

我与影子孤独终老i 提交于 2019-12-23 08:34:07
问题 Hey i'm trying to integrate SFML and Box2D, and SFML has made setting centers for sprites, shapes, etc. very easy. Box2D, on the other hand, I'm having trouble with as i can't figure out how to set or even find the center of a shape or fixture. It seems to me that when adding vertices manually to a b2_PolygonShape the center is set to the first vertex in the vertex array, but the results are very different when using the shortcut functions SetAsBox() or any other SetAs_ _ (). The Center is

Vertical Aligned Div

落爺英雄遲暮 提交于 2019-12-23 04:57:18
问题 Does anyone in here knows how to make a div go to the center of the page (vertically) no matter the screen resolution or window size of the user? As an example, the login page of Instagram. If you make your window smaller, the div will keep floating at the center until it gets to the top. I made that, but the problem was that when the user kept making the window smaller, the div was actually going out of the user window (to the top). Here is the Instagram login page for the example: https:/

How do I center a DIV in the exact center of a page using jQuery?

懵懂的女人 提交于 2019-12-23 03:35:21
问题 I need to center a DIV in the exact center of a page using jquery. My CSS style for the DIV is as follows: #page-content #center-box{ position:absolute; width:400px; height:500px; background:#C0C0C0; border:1px solid #000; } and my jQuery for centering is as follows: windowheight = $(window).height(); windowwidth = $(window).width(); pagecenterW = windowwidth/2; pagecenterH = windowheight/2; $("div#page-content div#center-box") .css({top: pagecenterH-250 + 'px', left: pagecenterW-200 + 'px'})

flex 3 component using x y as center, not topleft

三世轮回 提交于 2019-12-23 03:06:42
问题 How can I extend components like buttons to use x and y value as the center of the component, not the top left? 回答1: It's pretty easy in Flex 4 :). They have a transformAround method in the UIComponent, that allows you to transform the position/scale/rotation of a component around any arbitrary pivot. So you could do this: override public function set x(value:Number):void { var pivot:Vector3D = new Vector3D(this.width/2, this.height/2, 0); var translation:Vector3D = new Vector3D(value, this.y

Is it Possible to Center Content in a UIScrollView Like Apple's Photos App?

岁酱吖の 提交于 2019-12-23 02:57:23
问题 I have been struggling with this problem for some time and there seems to be no clear answer. Please let me know if anyone has figured this out. I want to display a photo in a UIScrollView that is centered on the screen (the image may be in portrait or landscape orientation). I want to be able to zoom and pan the image only to the edge of the image as in the photos app. I've tried altering the contentInset in the viewDidEndZooming method and that sort of does the trick, but there's several

Why are img and div widths miscalculated in Chrome?

早过忘川 提交于 2019-12-23 01:44:13
问题 I use following code to center images horizontally and vertically in DIV Properties given to DIV is width & height , overflow:hidden , and display:block . Problem: margin-top and margin-left miscalculated only in Chrome, while code is working perfectly in FF and IE $('.centerImage').each(function(i) { var divH = $(this).parent().height(); var divW = $(this).parent().width(); var orgImgH = $(this).height(); var orgImgW = $(this).width(); if (orgImgH > orgImgW) { $(this).css('width', divW); var

Center multiple UILabels on a line

故事扮演 提交于 2019-12-22 23:08:16
问题 I want to horizontally center multiple UILabels - as a group - on a line in Interface Builder. One the straight view controller i could not figure out how to do this. I read comments about place the UILabels in a View and then centering the view in the view controller. When I tried this, overtime I said to update frames in the interface builder, the View would be resized down to nothing. (i.e. its height and width would be set to 0 by IB). I need to know how to get this to work in interface

Center multiple UILabels on a line

て烟熏妆下的殇ゞ 提交于 2019-12-22 23:05:22
问题 I want to horizontally center multiple UILabels - as a group - on a line in Interface Builder. One the straight view controller i could not figure out how to do this. I read comments about place the UILabels in a View and then centering the view in the view controller. When I tried this, overtime I said to update frames in the interface builder, the View would be resized down to nothing. (i.e. its height and width would be set to 0 by IB). I need to know how to get this to work in interface