Questions tagged [text-align]

a property of CSS which determines the alignment of the text

The text-align property, as defined in CSS, can have one of the five values: left, right, center, justify and inherit.

The default value depends on the used locale and is left for languages in which text is written from left to right and right for languages in which text is written from right to left.

509 questions
749
votes
22 answers

Text-align class for inside a table

Is there a set of classes in Twitter's Bootstrap framework that aligns text? For example, I have some tables with $ totals that I want aligned to the right... Total and $1,000,000.00
mylesthe.dev
  • 9,267
  • 4
  • 20
  • 34
156
votes
8 answers

Align contents inside a div

I use css style text-align to align contents inside a container in HTML. This works fine while the content is text or the browser is IE. But otherwise it does not work. Also as the name suggests it is used basically to align text. The align property…
Hemanshu Bhojak
  • 15,934
  • 15
  • 46
  • 60
83
votes
11 answers

How to dynamically add a style for text-align using jQuery

I'm trying to correct the usual IE bugs around CSS 2.1 and need a way to alter an elements style properties to add a custom text-align style. Currently in jQuery you can do something like $(this).width() or $(this).height() but I can't seem to…
Toran Billups
  • 27,715
  • 39
  • 150
  • 262
54
votes
7 answers

CSS text-align: center; is not centering things

I have the following html:
RJ Cole
  • 2,350
  • 3
  • 14
  • 19
52
votes
3 answers

How can I horizontally center a button element in a div element?

I don't want to add CSS to my div element (e.g.
). I only want to add CSS code to the button element.
How can I center the button horizontally in this case?
weilou
  • 3,869
  • 8
  • 37
  • 56
50
votes
8 answers

Left aligned last row in centered grid of elements

I have a bunch of same-size blocks set to display:inline-block inside a div that has text-align:center set to align the blocks. | _____ _____ _____ _____ | | | | | | | | | | | | | 1 | | 2 | | …
Ivan Durst
  • 1,061
  • 2
  • 10
  • 23
50
votes
8 answers

"text-align: justify;" inline-block elements properly?

A few other questions have already addressed how best to apply text-align: justify to get inline-block elements to spread out evenly… for example, How do I *really* justify a horizontal menu in HTML+CSS? However, the 100% width element that "clears"…
thirdender
  • 3,721
  • 2
  • 26
  • 31
40
votes
9 answers

Justify the last line of a div?

I don't think the "why?" of this question is important...but what I need to do is to text-align:justify the last line of text from a DIV. Normally, the last line (or the first if there are no other lines, which is the current case) of a div isn't…
JCOC611
  • 17,315
  • 12
  • 61
  • 85
38
votes
4 answers

Bootstrap: how to not have text-right in certain size?

Using Twitter Bootstrap, when I reduce the size of my browser to XS size. This is my footer. I have the text-right property to handle the rest of the screen sizes, but on XS, it still aligns it to the right after stacking. How do I get this to not…
The Nomad
  • 6,385
  • 12
  • 58
  • 98
31
votes
4 answers

How to center images on a web page for all screen sizes

I'm having a problem with my HTML. I've searched all over the internet, but still no real answer. I have a website with some images, and I want them to be in the middle. Now, on my screen they're in the middle, but that's because I've put them there…
connor.p
  • 836
  • 9
  • 19
  • 29
26
votes
4 answers

center h1 in the middle of screen

How can I center horizontally and vertically a text? I don't want to use position absolute because I try with it and my other div getting worse. Is there another way to do that ? div { height: 400px; width: 800px; background:…
Dina
  • 263
  • 1
  • 3
  • 5
23
votes
5 answers

text-align in md-grid-tile (Angular Material) doesn't work

text-align in Angular Material doesn't work. {{video.created}} {{video.code {{ video.title…
rabun
  • 243
  • 1
  • 2
  • 8
21
votes
5 answers

Align printf output in Java

I need to display a list of items with their prices from an array and would like to align the prices. I almost have it working but needs improvements. Below is the code and the output. Any ideas how to make all prices aligned? So far some work but…
user1781482
  • 603
  • 2
  • 13
  • 23
19
votes
3 answers

CSS: align two element, to the left and right in the same line WHITHOUT floats

I am trying to align two inline elements, one to the left and one to the right. I'd like to accomplish this without using floats. In my case, I have a h1, with a span and a link. I'd like the span to align to the left and the link to align to the…
Omar
  • 10,419
  • 21
  • 76
  • 106
15
votes
9 answers

Margin: Auto not working in IE

URL: http://cyberbat.co.uk/test container margin: auto is not working, is there any other way to put it in the middle in IE. EDIT: Check it again, the index.php was the wrong file, I replaced it with index.html .
Lewes
  • 307
  • 1
  • 2
  • 9
1
2 3
33 34