• Hi guys,
    I’m trying to centre align a peice of text (using css defined textalign). Sounds easy.
    When I try to choose a class for it, it inserts a blank line above, which I don’t want.
    It does this because I’m using p class or div class.
    For some reason, when I use span class, the item is not centred.

    Any ideas?

Viewing 1 replies (of 1 total)
  • Try this:

    p.centered {
    text-align: center;
    margin: 0 auto;
    padding: 0;
    }

    A span is an inline level element, which is why it doesn’t work. You need to use a block level element like p or h3 to get this to work, then simply style the class you apply to it.

Viewing 1 replies (of 1 total)
  • The topic ‘Class problems, please help’ is closed to new replies.