centering

Center text character ☢ vertically and horizontally within a circle (CSS)

自作多情 提交于 2019-12-02 01:24:08
I am trying to center this text character ☢ within a circle. (☢) While IE 10 displays the text vertically and horizontally centered, both Chrome and Firefox render too much padding at the top. Any ideas how to fix this? (Flexbox is not a must have) HTML <div class="tl-icon"> <div>☢</div> </div> CSS .tl-icon { align-items: center; background: black; border-radius: 50%; color: yellow; display: flex; font-size: 3em; height: 3rem; justify-content: center; width: 3rem; } See live demo here: http://codepen.io/dash/pen/ZYePWP ITroubs The problem is that the inner child is a text which screws with

python: calculate center of mass

梦想与她 提交于 2019-12-01 22:59:15
I have a data set with 4 columns: x,y,z, and value, let's say: x y z value 0 0 0 0 0 1 0 0 0 2 0 0 1 0 0 0 1 1 0 1 1 2 0 1 2 0 0 0 2 1 0 0 2 2 0 0 I would like to calculate the center of mass CM = (x_m,y_m,z_m) of all values. In the present example, I would like to see (1,1.5,0) as output. I thought this must be a trivial problem, but I can't find a solution to it in the internet. scipy.ndimage.measurements.center_of_mass seems to be the right thing, but unfortunately, the function always returns two values (instead of 3). In addition, I can't find any documentation on how to set up an ndimage

How to keep form centered to the middle of the screen after resize

喜欢而已 提交于 2019-12-01 20:54:35
I have a form that is centered according to the screen position that I resize by fontsize when loading. After resizing the location remains the same as it was before resizing so the form is no longer in the center, like I would like. Let me draw you a sketch: I've tried calling this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.ResumeLayout(false); this.PerformLayout(); again after resizing (this is, I believe, the part of the code that centers the form in the beginning). It didn't work. I've also found some similar issues like this: "Keeping winform control

Centering horizontal submenu below parent with css

风格不统一 提交于 2019-12-01 19:14:11
Best shown with a Fiddle: http://jsfiddle.net/Jnttm/ How can I get the sub-menu to center underneath the parent menu-item? A lot of the centering tricks I've found don't apply because the child element is wider than the parent. Is this possible with pure CSS or do I have to resort to javascript? If JS is required does anyone have JQuery code handy for doing this? May be you have to define a default width to your submenu like this : .sub-menu { display: none; position: absolute; top: 20px; left: 0; white-space: nowrap; text-align:center; left:50%; margin-left:-150px; width:300px; } .active .sub

Centering in CSS, when the object is larger than the viewport

强颜欢笑 提交于 2019-12-01 09:15:02
问题 I'm trying to get a jquery carousel centered on the screen, even when the clipping area is wider than the viewport. This will basically always give the element a negative left margin -- how can I specify this? The clipping area is a fixed width but of course the viewport area is variable. 回答1: Here's the best solution I've been able to find uses a wrapping element around your-fixed-width content, then a -50% margin on the content itself. This is off the top of my head, but it should be enough

Centering an individual character with DrawString

两盒软妹~` 提交于 2019-12-01 06:02:05
I have tried all of the suggested ways to center text, but I can't seem to get the results I want while centering an individual character. I have a rectangle. In that rectangle I'm drawing a circle with DrawEllipse. Now I want to draw a single character inside the circle using the same rectangle and DrawString, to have it perfectly centered. Here is my basic code: StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; using (Graphics g = Graphics.FromImage(xImage)) { g.SmoothingMode = SmoothingMode

CSS “margin: 0 auto” not centering

☆樱花仙子☆ 提交于 2019-12-01 04:48:11
Okay I understand that this topic has been covered. But I have looked at various solutions and have had little success with them. I just have no clue why this margin: 0 auto; is not working. I tried compensating the padding with width: calc(33% - 40px); , but this did not work. Any help on why this is happening, with solutions would be greatly appreciated! .container { margin: 0 auto; } [class*='col-'] { float: left; } .col-2-3 { width: 66.66%; } .col-1-3 { width: 33.33%; } .grid:after { content: ""; display: table; clear: both; } .col-word { width: auto; height: auto; padding: 25px; border:

how to center JLabel in Jframe Swing?

我只是一个虾纸丫 提交于 2019-12-01 03:30:23
I have this working code for a stop watch in Swing. I want to have the label Time Remaining 300 seconds centered on the second line`. here is my code. import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.Timer; public class TimerGUI extends JPanel { JLabel promptLabel, timerLabel; final int count = 30; JButton start; JButton end; Timer timer; public TimerGUI() {

How To Center Image Within Bootstrap Column [duplicate]

牧云@^-^@ 提交于 2019-12-01 00:42:43
This question already has an answer here: Centering the image in Bootstrap 3 answers How do you get centered content using Twitter Bootstrap? 23 answers Bootstrap: How to center align content inside column? [duplicate] 2 answers I have several images within bootstrap columns like this: <div class="services"> <div class="container"> <div class="row"> <div class="col-md-3 services-section"> <img src="/images/website_design_icon.png"/> <div class="services-paragraph"> <h3>Website Design</h3> <p>WordPress themes built for design and functionality</p> </div> </div> <div class="col-md-3 services

Centering text in C# console app only working with some input

梦想的初衷 提交于 2019-11-30 20:33:49
I am having a problem with centering text in a C#.NET4 console app. This is my method for centering the text: private static void centerText(String text) { int winWidth = (Console.WindowWidth / 2); Console.WriteLine(String.Format("{0,"+winWidth+"}", text)); } However, I just get the output as it would have been outputted normally. If I however use this line: Console.WriteLine(String.Format("{0,"+winWidth+"}", "text")); The "text" gets centered as it should. I am calling centerText with these two methods: private static void drawStars() { centerText("********************************************