0

I have a <div> with text-align:left - inside that: a <p> with text-align:center.
The "closest" property should win = center - but it doesn't all 3 <p>'s are left-aligned ?!?
Same result in both Firefox and Chrome - This is how it looks in Chrome's "inspector": enter image description here
NB: I can't reproduce it in a simple html-file..
Any idea what's happening here ?

EDIT: Found it finally: I'd hyphenated (those damn invisible shy's) a little too thoroughly...

T4NK3R
  • 4,245
  • 3
  • 23
  • 25

2 Answers2

1

The problem was "silent hyphens" (& shy;) in my CSS.

Bart
  • 19,692
  • 7
  • 68
  • 77
T4NK3R
  • 4,245
  • 3
  • 23
  • 25
0

From what you've shown us, it doesn't make sense. But I'm going to guess that, somewhere in a CSS file, there is something like:

p {text-align: left !important;}
Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
  • Wrong, you can see in the inspector `element.style` is overruled. This kind of inline css already override any distant CSS. It should come from some JS code I guess. – zessx May 30 '12 at 18:57
  • 1
    Nope - a `!important` rule will even override locally applied styles like this one. – Niet the Dark Absol May 30 '12 at 18:57
  • @T4NK3R What happens if you just remove the `text-align:left` from the containing `
    `? Since all of its children are block-level elements with a specific `text-align`, it's kind of redundant.
    – Niet the Dark Absol May 30 '12 at 19:03
  • @Kolink - Then it's centered. (There IS no !important) What about the "Unknown property name" message ? – T4NK3R May 30 '12 at 19:05
  • Did you notice the `unknown property name` ? Could it have some special generated chars in "text-align" ? Try to rewrite it manually – zessx May 30 '12 at 19:05
  • @samsamX The html is delivered by CKeditor.. But I tried different kinds of alignment (right + justify) - both get overruled too - yet both work fine if the [div] doesn't have it's text-align:left. VERY strange.. – T4NK3R May 30 '12 at 19:18
  • @Kolink - no it's not redundant. If there's no specific alignment of the [p]'s I WANT them to inherit left from the parent-[div] - since that in turn inherits center from it's parent - this is deep : ) – T4NK3R May 30 '12 at 19:22