center

Center multiple UILabels on a line

核能气质少年 提交于 2019-12-22 23:05:01
问题 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

How to center Popup in Metro style app in c#

耗尽温柔 提交于 2019-12-22 18:48:18
问题 Is there any way to show a Popup in Windows 8 Metro centered? Setting VerticalAlignment and HorizontalAlignment to "Center", and VerticsalOffset and HorizontalOffset to 0 causes howing popup with left-up corner in the center of the screen. Is there any way to do it nicely? To make this problem harder, this popup has different size in snapped view, where is also should be centered. Any thoughts? 回答1: Hope this helps, how about placing the popup in a canvas then manipulate the canvas... XAML

Crop centered image inside div

[亡魂溺海] 提交于 2019-12-22 14:52:30
问题 I have a div containing an image (img) element, which extends for 100% width inside it. I would like to specify a maximum height for the div, and hide the parts of the image exceeding this height. But I also want to keep this image centered vertically inside the div to show only its central part. For example, if browser width is 1200px and image aspect ratio is 4:3, image should display (1200x900)px. But if we want to crop height to 300px only and center vertically, image should position at

Crop centered image inside div

旧巷老猫 提交于 2019-12-22 14:52:01
问题 I have a div containing an image (img) element, which extends for 100% width inside it. I would like to specify a maximum height for the div, and hide the parts of the image exceeding this height. But I also want to keep this image centered vertically inside the div to show only its central part. For example, if browser width is 1200px and image aspect ratio is 4:3, image should display (1200x900)px. But if we want to crop height to 300px only and center vertically, image should position at

How to align a div to the left and another div to the center?

半城伤御伤魂 提交于 2019-12-22 08:34:53
问题 Both divs are inside another div : #container { width: 100%; } #container > .first { display:inline-block; float:left; width:100px; } #container > .second { display:inline-block; float:right; margin: 0 auto; width:100px; } <div id='container'> <div class='first'>Left</div> <div class='second'>Right</div> </div> The second div is aligned right not center though. How do I get it centered without using tranforms? I also need it so it is in one line, no stacking. 回答1: Unfortunately there is no

Bootstrap: How to align the button group in the center (vertically)

做~自己de王妃 提交于 2019-12-22 08:34:34
问题 In the following code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"

Justify and Center <textarea> text HTML/CSS?

吃可爱长大的小学妹 提交于 2019-12-22 08:08:50
问题 I have a textarea and I want it to be justified so all the lines are equal in width and to be centered to the text stays in the middle of the textarea when it's not at maximum line length. This is my textarea: <textarea class="Whiteboard" type="text" placeholder="Type something..."></textarea> ...and the CSS: textarea.Whiteboard{ resize: none; background-color: #F1F1F1; border: none; height: 500px; width: 800px; text-align: center; font-size: 50px; } Thank you all! 回答1: Unfortunately there is

Why are images centered vertically with `line-height` positioned 2 pixels below where they should be?

不羁的心 提交于 2019-12-22 03:57:29
问题 Short story: jsfiddle here. The behavior is consistently wrong in Chrome 21, Firefox 15 and IE9, which makes me think I'm misunderstanding something about the CSS spec. Longer story: I want to center an image vertically using line-height. I've set the height of the image container equal to the line-height, I've reset margins, paddings and borders for all elements, yet the image is 2 pixels below where it should be. This happens whether the image is smaller than the container, or larger than

How to center a header image

与世无争的帅哥 提交于 2019-12-21 21:17:55
问题 I have a problem. The answers to other people questions didn't solve my problem. It's about image in my header, here's the code: HTML <div id="site"> <div id="header"> <img class="center" src="http://i.imgur.com/jfDhpP5.png"/> </div> <div id="mainNav"> <li><a href="#">one</a></li> <li><a href="#">two</a></li> <li><a href="#">three</a></li> <li><a href="#">four</a></li> </div> </div> CSS #container{ width: 1000px; margin: 1em auto; } #header{ display: block; width: 1000px; margin: 0 auto; }

Using UIScrollView, when Zooming Out, how can I keep the content view at the center?

北城以北 提交于 2019-12-21 20:56:11
问题 The minimum scale is 0.5 The maximum scale is 2.0 I need to always use larger contentSize for UIScrollView to be able to drag around the content. So, as the CGRect of the content is changing, contentSize of UIScrollView is also changing. However, as I zoom out, if the scale is going below 1.0, contentOffset is abruptly changed to {0.0, 0.0}, making it very difficult to resize the content while keep it's position to the overlay view (e.g. a clothe image). In other words, I can't make the