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.

586 questions
8
votes
4 answers

Text overflow behaviour in CSS with non-left values for text-align

Given the following HTML:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore

And the following CSS: p { border: 1px solid red; width: 200px; text-align: right; white-space:…
Robin Whittleton
  • 6,159
  • 4
  • 40
  • 67
8
votes
8 answers

How to add whitespace before a string

I need your help in adding whitespace before a string as I need to format the String value to be in a specific position in the page. For example: System.out.println(" Hello Word!!"); The above will give 10 spaces before the String which…
99maas
  • 1,239
  • 12
  • 34
  • 59
7
votes
2 answers

CSS equivalent to Photoshop's Justify-All

I'd like to take an h2 element and span it's text across the width of it's div. text-align:justify; only spreads the text if it's width is greater than the width of it's container... kind of like Photoshop's justify-left
technopeasant
  • 7,809
  • 31
  • 91
  • 149
7
votes
3 answers

CSS text-align on inline-block element

I have this structure:
This string is left-aligned
//contains other divs.I used inline block for making this div as large as //content ATTENTION: its width is not…
luca
  • 36,606
  • 27
  • 86
  • 125
7
votes
3 answers

text-align: right on a span inside li tag

my structure looks like this:
7
votes
3 answers

Can i use text-align inside div by pixel?

Is there any way that i can align the text inside a div but without using text-align. I dont want to align it to a specific position(center,left etc) but i want to align it where ever i want by pixel.For example between the values center and left.…
laaposto
  • 11,835
  • 15
  • 54
  • 71
6
votes
6 answers

Text Centering Using CSS not working in IE

I am having problems getting text within a table to appear centered in IE. In Firefox 2, 3 and Safari everything work fine, but for some reason, the text doesn't appear centered in IE 6 or 7. I'm using: h2 { font: 300 12px "Helvetica", serif; …
Shady Studios
  • 63
  • 1
  • 2
  • 4
6
votes
5 answers

How can I use text-align-last except when I have only one line of text?

I would like to align text to the center, but last line to the left: section { text-align: center; text-align-last: left; } It works well, but what if there is only one line? In this case, I would like to align text to the center, which…
Vesmy
  • 1,190
  • 4
  • 15
  • 29
6
votes
2 answers

IE7 text-align not working

I have a simple horizontal UL LI main nav which I am trying to align to the center of the page. Text-align, which works in the other browsers is working but this does not work in IE7. Is there something I am missing about this bug in IE7? Thanks!
Sixfoot Studio
  • 2,951
  • 7
  • 26
  • 35
6
votes
1 answer

In HTML, can you shrink a paragraph to make sentences have the same width?

I want to display a short text-align-centered sentence like this.

This is a variable-length sentence which is sometimes only a few words and sometimes up to three lines long.

This…
Hildo Bijl
  • 83
  • 1
  • 4
6
votes
1 answer

How to remove first line indent of text in html

I'm having trouble formatting my output. I want each line of text to be horizontal on the left side. Here is the code I am using.
John
  • 63
  • 1
  • 4
6
votes
2 answers

text-align right and padding right

I've seen this posted everywhere, with no real help, or it being closed for no reason other then moderators feeling it would be 'unhelpful' in the future even though google whips up a nice result summing some 55,000+ relevant results. So, why won't…
WASasquatch
  • 1,044
  • 3
  • 11
  • 19
6
votes
1 answer

Bootstrap max-width columns responsive

I am trying to code a section of a one-page responsive Bootstrap design that has two side-by-side columns of text. The designer wants these two columns to have a max-width, but once it reaches its max, it is no longer centered (as the rest of the…
user3389584
  • 135
  • 2
  • 2
  • 7
6
votes
2 answers

Strange behaviour when using text-align justify/text-justify and right

I ran into one IE-specific problem that I just can't wrap my head around. The following HTML and CSS can be seen live in this pen. :: HTML
Dummy
6
votes
1 answer

Aligning Text with a ContentControl using the HorizontalContentAlignment property

I am attempting to apply a "text alignment" to a ContentControl. Since the ContentControl does not have a horizontal or vertical text alignment property like the TextBlock, I am attempting to use the ContentControl's HorizontalContentAlignment…
Frinavale
  • 3,908
  • 10
  • 44
  • 74
1 2
3
39 40