centering

Center Navbar in Twitter Bootstrap 2.0

扶醉桌前 提交于 2019-11-28 05:23:17
Suppose we have the following markup for navigation bar using Twitter Bootstrap 2.0. <div class="navbar navbar-fixed-top"> <div class="navbar-inner pull-center"> <ul class="nav"> <li class="active"><a href="#">HOME</a></li> <li><a href="#contact">CONTACT</a></li> </ul> </div> </div> What is the best way to center .nav inside navbar-inner ? I only came up with adding my own CSS styles: @media (min-width: 980px) { .pull-center { text-align: center; } .pull-center > .nav { float:none; display:inline-block; *display: inline; *zoom: 1; height: 32px; } } Override the width of the container within

Attributed Text Center Alignment

大憨熊 提交于 2019-11-28 05:10:33
I have tried everything but cannot seem to center this text. Can someone please tell me where the error is. NSMutableParagraphStyle *paragraphStyle = NSMutableParagraphStyle.new; paragraphStyle.alignment = NSTextAlignmentCenter; label.attributedText = [[NSAttributedString alloc] initWithString:cell.EventTitle.text attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor],NSParagraphStyleAttributeName:paragraphStyle,NSBaselineOffsetAttributeName : @0,NSFontAttributeName : [UIFont fontWithName:@"BrandonGrotesque-Black" size:34]}]; Shrawan In Swift-4 let paragraph =

Twitter Bootstrap: Center Text on Progress Bar

佐手、 提交于 2019-11-28 03:32:38
I've been using Twitter's bootstrap and I would like the text on the progress bar to be centered on the on bar regardless of value. The below link is what I have now. I would like all text to be aligned with the bottom most bar. Screenshot: I've tried my best with pure CSS and I'm trying to avoid using JS if possible but I'm willing to accept it if it's the cleanest way to do it. <div class="progress"> <div class="bar" style="width: 86%">517/600</div> </div> Bootstrap 4.0.0 with utility classes: (Thanks to MaPePeR for the addition) <div class="progress position-relative"> <div class="progress

How do I keep a label centered in WinForms?

試著忘記壹切 提交于 2019-11-28 03:21:39
In WinForms I am using a Label to display different messages like success, failure, etc. I'd like to center that label in the center form. I want a solution that will keep it centered whether there's just one word or a whole sentence in the label. Set Label 's AutoSize property to False , TextAlign property to MiddleCenter and Dock property to Fill . You will achive it with setting property Anchor: None. user3866622 Some minor additional content for setting programmatically: Label textLabel = new Label() { AutoSize = false, TextAlign = ContentAlignment.MiddleCenter, Dock = DockStyle.None, Left

Vertically center rotated text with CSS

☆樱花仙子☆ 提交于 2019-11-28 03:18:34
I have the following HTML: <div class="outer"> <div class="inner rotate">Centered?</div> </div> div.outer is a narrow vertical strip. div.inner is rotated 90 degrees. I would like the text "Centered?" to appear centered in its container div. I do not know the size of either div in advance. This comes close: http://jsfiddle.net/CCMyf/2/ . You can see from the jsfiddle that the text is vertically centered before the transform: rotate(-90deg) style is applied, but is somewhat offset after. This is particularly noticeable when div.outer is short. Is it possible to center this text vertically

Vertically center text in a 100% height div?

孤人 提交于 2019-11-27 21:02:22
I am working with a div that is 100% of the parent divs height. The div only contains a single line of text. The div cannot have a fixed height. So my question is. How do I vertically center the line of text? I have tried using: display: table-cell; line-height:200%; If it is important the div is absolutely positioned. Current CSS .requests { position: absolute; right: 0; height: 100%; width: 50px; padding: 0 10px; background-color: #69A4B5; display: table-cell; vertical-align: middle; border-bottom-right-radius: 5px; } This answer is no longer the best answer ... see the flexbox answer below

How to center a navigation bar with CSS or HTML?

拟墨画扇 提交于 2019-11-27 20:48:49
I am having difficulty with centering the navigation bar on this page . I tried nav { margin: 0 auto; } and a bunch of other ways, but I still can't center it. #nav ul { display: inline-block; list-style-type: none; } It should work, I tested it in your site. Add some CSS: div#nav{ text-align: center; } div#nav ul{ display: inline-block; } Brandon If you have your navigation <ul> with class #nav Then you need to put that <ul> item within a div container. Make your div container the 100% width. and set the text-align: element to center in the div container. Then in your <ul> set that class to

center <IMG/> inside a <DIV> with CSS

ぃ、小莉子 提交于 2019-11-27 15:08:48
I want to center image inside a div. The div has fixed width 300px. The image width is known only at runtime. It usually is bigger then 300px, so image should be centered and cut right and left. margin 0 auto does not work in this case. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <style type="text/css"> div{width:300px;border:1px solid red; overflow:hidden} img{ /* NOTE!!!! margin:auto; doesn't work when image width is bigger than div width image width is known only at runtime!!! */ } </style> </head>

CSS Centering with Transform

让人想犯罪 __ 提交于 2019-11-27 14:44:34
问题 why does centering with transform translate and left 50% center perfectly (with position relative parent) but not right 50%? Working example: span[class^="icon"] { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } Example that doesn't center: span[class^="icon"] { position: absolute; top: 50%; right: 50%; transform: translate(-50%, -50%); } 回答1: Because translateX(-50%) moves something back to the left 50% (because of the - negative value), which means it pairs with

Vertically centering a div in body?

ぐ巨炮叔叔 提交于 2019-11-27 13:42:43
问题 I have tried to center this vertically in body (not horizontally). Also, I do not want to specify heights or anything like that. I tried adding a wrapper with a 100% height and other things, but got nowhere. Can you please help me fix this? jsFiddle Here <form name="signup" class="signup" action="signup.php" style="border: 1px solid #000; "> <input type="text" placeholder="Email"/><br> <input type="text" placeholder="Username"/><br> <input type="password" placeholder="Password"/><br> <button