How to avoid a new line after an image while using styles

Discussion in 'HTML' started by Stefan Mueller, Mar 9, 2006.

  1. If I use
    <img src = "pic.gif"> Text
    the word 'Text' is located on the right side of the image 'pic.gif'.

    However, if I use
    <img src = "pic.gif"><div class = "my_style"> Text</div>
    the word 'Text' is not located on the right side of the image 'pic.gif'.
    It's located on a new line.

    I guess I need to use <div...></div> because I'd like to set a style (font,
    size, weight, color, margins, ...) to the word 'Text'.

    How can I set a style to the word 'Text' so that the word 'Text' is still
    located on the right side of the image 'pic.gif'?
    Stefan
    Stefan Mueller, Mar 9, 2006
    #1
    1. Advertising

  2. Stefan Mueller

    Mark Parnell Guest

    Deciding to do something for the good of humanity, Stefan Mueller
    <> declared in alt.html:

    > However, if I use
    > <img src = "pic.gif"><div class = "my_style"> Text</div>
    > the word 'Text' is not located on the right side of the image 'pic.gif'.
    > It's located on a new line.


    That's because <div> is a block-level element.

    > How can I set a style to the word 'Text' so that the word 'Text' is still
    > located on the right side of the image 'pic.gif'?


    Replace div with span.

    --
    Mark Parnell

    Now implementing http://blinkynet.net/comp/uip5.html
    Mark Parnell, Mar 9, 2006
    #2
    1. Advertising

  3. > Replace div with span.

    Great, that works.

    Many thanks
    Stefan
    Stefan Mueller, Mar 9, 2006
    #3
    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. Earl Teigrob
    Replies:
    2
    Views:
    358
    Earl Teigrob
    Feb 20, 2004
  2. Alexander Malkis
    Replies:
    8
    Views:
    509
    Alexander Malkis
    Apr 14, 2004
  3. zxo102
    Replies:
    0
    Views:
    404
    zxo102
    Aug 1, 2006
  4. Roger23
    Replies:
    2
    Views:
    986
    Roger23
    Oct 12, 2006
  5. lawpoop
    Replies:
    17
    Views:
    742
    Thomas 'PointedEars' Lahn
    Jun 22, 2009
Loading...

Share This Page