Align printf output in Java

You can try the below example. Do use ‘-‘ before the width to ensure left indentation. By default they will be right indented; which may not suit your purpose. Format String Syntax: http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax Formatting Numeric Print Output: https://docs.oracle.com/javase/tutorial/java/data/numberformat.html PS: This could go as a comment to DwB’s answer, but i still don’t have permissions to … Read more

CSS text-align not working

Change the rule on your <a> element from: to Just add two new rules (width:100%; and text-align:center;). You need to make the anchor expand to take up the full width of the list item and then text-align center it. jsFiddle example

CSS text-align: center; is not centering things

I assume you want all the items next to each other, and the whole thing to be centered horizontally. li elements are display: block by default, taking up all the horizontal space. Add once you’ve done that, you probably want to get rid of the list’s bullets: