centering

Is it possible to horizontally center an inline element without extra markup or styling parent containers?

孤人 提交于 2020-06-09 10:05:49
问题 The question is basically already stated in the title, but to clarify: I'm trying to horizontally center an anchor <a> in a main content area. I would like to do this without : Using fixed widths Adding extra markup (an extra parent div for example) Styling the parent container (so setting the parent to text-align:center for example) Setting the <a> as a full width block (I would like to keep the clickable area a big as the link itself) So basically I would like to do this just by styling the

How to center image when creating images from PDF using GhostScript

送分小仙女□ 提交于 2020-02-08 08:37:27
问题 I have several pdf files with different sizes and different width to height ratios. Now I want to create fixed-size thumbnails from 1st page of these files. I do this using this command: gs -dNOPAUSE -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -sOutputFile=d:\test\a.jpeg -dJPEGQ=100 -g509x750 -dUseCropBox=true -dPDFFitPage=true -q d:\test\a.pdf -c quit Since the original files are of different widths and heights but thumbnails should be of the same size, there will be white margins in the right

Center Item Inside Horizontal Stack

一世执手 提交于 2020-01-28 11:18:29
问题 If I have 3 items inside a Horizontal Stack, I thought I could do something like this: HStack{ Text("test") Spacer() item2() Spacer() Text("test") } to center item2() in between the two Text views. However, the problem with this is that item2() isn't necessarily always centered, because, lets say Text("test") changes to Text("a") or something. This causes problems, and the second item isn't always centered on the screen. How can I make it so item2() is always centered? Thanks 回答1: I would

extjs - center a formPanel on a normal panel

浪尽此生 提交于 2020-01-24 11:54:06
问题 I'm using extjs and just trying to solve a simple problem: I have a form with a fixed width. I want to Center this form within a normal Ext.Panel. I'm trying to achieve this the 'css-way' - setting the left and right margin to 'auto'. But this doesn' work, it seems the margins are just ignored. The Code: var curStateForm = new Ext.FormPanel({ title:'test', width:300, bodyStyle:'margin:5px auto 0 auto', items: [edIst, edAdjust, edSumme] }); var testPanel = new Ext.Panel({ width: '100%', frame

extjs - center a formPanel on a normal panel

二次信任 提交于 2020-01-24 11:53:48
问题 I'm using extjs and just trying to solve a simple problem: I have a form with a fixed width. I want to Center this form within a normal Ext.Panel. I'm trying to achieve this the 'css-way' - setting the left and right margin to 'auto'. But this doesn' work, it seems the margins are just ignored. The Code: var curStateForm = new Ext.FormPanel({ title:'test', width:300, bodyStyle:'margin:5px auto 0 auto', items: [edIst, edAdjust, edSumme] }); var testPanel = new Ext.Panel({ width: '100%', frame

extjs - center a formPanel on a normal panel

狂风中的少年 提交于 2020-01-24 11:53:38
问题 I'm using extjs and just trying to solve a simple problem: I have a form with a fixed width. I want to Center this form within a normal Ext.Panel. I'm trying to achieve this the 'css-way' - setting the left and right margin to 'auto'. But this doesn' work, it seems the margins are just ignored. The Code: var curStateForm = new Ext.FormPanel({ title:'test', width:300, bodyStyle:'margin:5px auto 0 auto', items: [edIst, edAdjust, edSumme] }); var testPanel = new Ext.Panel({ width: '100%', frame

Center a short text block that is align left

匆匆过客 提交于 2020-01-23 11:19:29
问题 It is easy to center a long text with margin 0 auto and control the distance with the margin or the padding. But, Is it possible to center a text without knowing the width and if that text is align left ? Center a short text text alignt left I don't know the width Here is the example to check: http://jsfiddle.net/j4Y3k/5/ CSS: #long { margin:50px auto; text-align:left; padding: 0px 100px; background:white; } #short { margin:0px auto; text-align:left; } HTML: <div id="long"> long, long,long,

How to center a plotted image?

江枫思渺然 提交于 2020-01-15 06:34:41
问题 I didn't post the whole code because most of it isn't relevant. I just need help with centering the image. ra_new2=cat['ra'][z&lmass&ra&dec][i] dec_new2=cat['dec'][z&lmass&ra&dec][i] target_pixel_x = ((ra_new2-ra_ref)/(pixel_size_x))+reference_pixel_x target_pixel_y = ((dec_new2-dec_ref)/(pixel_size_y))+reference_pixel_y fig = plt.figure(figsize=(5.,5.)) galaxy=plt.imshow(img[target_pixel_x-200:target_pixel_x+200, target_pixel_y- 200:target_pixel_y+200], vmin=-0.01, vmax=0.1, cmap='Greys')

How do I align text to the middle of an element with CSS in Twitter Bootstrap?

谁说我不能喝 提交于 2020-01-12 03:35:27
问题 I am using Bootstrap alerts and this is my success alert message: <div class="alert alert-success" id="UploadSuccess"> <a class="close" data-dismiss="alert">×</a> <strong>Congrats!</strong> You have successfully did it!. </div> And the result is: As you'll can see that the text alignment is at the top of the <div> . So, how would II align it to the middle? I have tried using padding-top and vertical-align:middle but neither works (I end up with the same result). What do I need to do to change

How to center the images in the Owl Carousel

限于喜欢 提交于 2020-01-12 03:08:52
问题 My Owl Carousel contains pictures of different width and height. How do I align them in the middle - both horizontally and vertically? $("#owl-example").owlCarousel({ navigation: true }); <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css"> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.theme.min.css"> <div id="owl-example" class="owl-carousel"> <div><img src="//placehold.it/120x120/69c/fff/" alt=""></div