span problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shel

    span problem

    Sorry to bother you; in the below test, <SPAN> doesn't do the text
    alignment. What's wrong? Using Opera 7.50 for Windows.

    <HTML>
    <HEAD>
    </HEAD>

    <BODY>

    <P>regular text
    <span style="text-align:center">t ext-to-center</span>
    </p>

    <!--
    It didn't center the text-to-center
    -->

    <P style="text-align:center">
    text-to-center
    </p>

    </body>
    </HTML>

    --
    Sheldon Isaac
    lose all .control when replying
  • Chris Morris

    #2
    Re: span problem

    Shel <sisaac.control @netaccess.cont rol.com> writes:[color=blue]
    > Sorry to bother you; in the below test, <SPAN> doesn't do the text
    > alignment. What's wrong? Using Opera 7.50 for Windows.[/color]

    text-align only applies to block elements - span is not a block element.
    [color=blue]
    > <P>regular text
    > <span style="text-align:center">t ext-to-center</span>
    > </p>[/color]

    Options:
    <p>regular text</p>
    <p style='text-align: center'>text-to-center</p>

    or

    <p>regular text
    <span style='text-align: center; display: block;'>text-to-center</span>
    </p>

    depending on whether the text being centred is logically part of that
    paragraph (2nd option) or not (1st option, probably more likely in
    most cases)

    --
    Chris

    Comment

    • Philipp Lenssen

      #3
      Re: span problem

      Shel wrote:
      [color=blue]
      > Sorry to bother you; in the below test, <SPAN> doesn't do the text
      > alignment. What's wrong? Using Opera 7.50 for Windows.
      >[/color]
      [color=blue]
      >
      > <P>regular text
      > <span style="text-align:center">t ext-to-center</span>
      > </p>
      >
      > <!--
      > It didn't center the text-to-center
      > -->
      >[/color]

      Spans are inline elements, try a block level element like a div.

      --
      Google Blogoscoped
      A daily news blog and community covering Google, search, and technology.

      Comment

      • Shel

        #4
        Re: span problem

        Chris Morris <c.i.morris@dur ham.ac.uk> wrote:[color=blue]
        > text-align only applies to block elements - span is not a block element.[/color]
        [color=blue]
        > <p>regular text</p>
        > <p style='text-align: center'>text-to-center</p>
        >
        > or
        >
        > <p>regular text
        > <span style='text-align: center; display: block;'>text-to-center</span>
        > </p>
        >
        > depending on whether the text being centred is logically part of that
        > paragraph (2nd option) or not (1st option, probably more likely in
        > most cases)[/color]

        Thank you very much!

        It was the "first option" situation

        --
        Sheldon Isaac
        lose all .control when replying

        Comment

        Working...