Something about image centering

Discussion in 'HTML' started by Steve Greenaway, Dec 5, 2004.

  1. http://www.engsoc.carleton.ca/~macfisto/4thyear.html

    <span class="equation"><img.... /></span> should centre an image inside
    the containing paragraph/div/whatever with the .equation styled as
    text-align= center shouldn't it? It's not working for me and it's
    starting to drive me a little bit nuts... Advice would be appreciated.

    --
    - Steve
    "I think a good friend would recommend CLR to all his friends."
     
    Steve Greenaway, Dec 5, 2004
    #1
    1. Advertising

  2. Steve Greenaway wrote:

    > http://www.engsoc.carleton.ca/~macfisto/4thyear.html
    >
    > <span class="equation"><img.... /></span> should centre an image inside
    > the containing paragraph/div/whatever with the .equation styled as
    > text-align= center shouldn't it?


    No, it shouldn't. Unless you play around with float or display, span
    elements are inline and the text-align property doesn't apply to them.
    (Since the width property doesn't apply either, and the element shrink
    wraps its content - there isn't any margin for centring anyway).


    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Dec 5, 2004
    #2
    1. Advertising

  3. Kermit the Frog stuck a mic in David's face, who said:
    >Steve Greenaway wrote:


    >> http://www.engsoc.carleton.ca/~macfisto/4thyear.html
    >>
    >> <span class="equation"><img.... /></span> should centre an image inside
    >> the containing paragraph/div/whatever with the .equation styled as
    >> text-align= center shouldn't it?


    >No, it shouldn't. Unless you play around with float or display, span
    >elements are inline and the text-align property doesn't apply to them.
    >(Since the width property doesn't apply either, and the element shrink
    >wraps its content - there isn't any margin for centring anyway).


    So I have to wrap each equation image in a block-level element like p
    or div? Fair enough. Thanks.

    --
    - Steve
    "I think a good friend would recommend CLR to all his friends."
     
    Steve Greenaway, Dec 5, 2004
    #3
  4. Steve Greenaway wrote:

    >>No, it shouldn't. Unless you play around with float or display, span
    >>elements are inline and the text-align property doesn't apply to them.
    >>(Since the width property doesn't apply either, and the element shrink
    >>wraps its content - there isn't any margin for centring anyway).


    > So I have to wrap each equation image in a block-level element like p
    > or div?


    Yes, anything else wouldn't make sense as you wouldn't have any space to
    centre the image in.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Dec 5, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry Camel

    Centering an image with text

    Jerry Camel, Sep 23, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    536
    John Timney \(ASP.NET MVP\)
    Sep 23, 2005
  2. Richard

    Re: Centering image on page?

    Richard, Jun 25, 2003, in forum: HTML
    Replies:
    0
    Views:
    3,760
    Richard
    Jun 25, 2003
  3. Jerry Muelver

    Re: Centering image on page?

    Jerry Muelver, Jun 25, 2003, in forum: HTML
    Replies:
    0
    Views:
    834
    Jerry Muelver
    Jun 25, 2003
  4. mr_vocab
    Replies:
    4
    Views:
    695
    mr_vocab
    May 24, 2004
  5. Samuël van Laere

    Image centering

    Samuël van Laere, Dec 5, 2004, in forum: HTML
    Replies:
    4
    Views:
    524
    David Dorward
    Dec 5, 2004
Loading...

Share This Page