Can I make the container DIV of an image not taller than the image (HTML 4.01)?

Discussion in 'HTML' started by Vince C., Jun 30, 2003.

  1. Vince C.

    Vince C. Guest

    Hi,

    Might be a stupid question but bear with me. I feel newbie since I plunged
    into HTML 4.01... I'd like a DIV to contain an image to the right side. The
    image should set the DIV maximum height. If the contained text inside the
    div overflows, the DIV should scroll vertically. Can I achieve this?

    Thanks,
    Vince C.
    Vince C., Jun 30, 2003
    #1
    1. Advertising

  2. Vince C.

    Vince C. Guest

    Thanks a lot, Ernest.

    I needed such simple things for what I write tends to be much too
    complicated... I have to get used to HTML 4.01 :)

    Thanks again.
    Vince C.

    ------

    "Ernest Cline" <> a écrit dans le message de
    news:bdpgq5$h27$...
    >
    > "Vince C." <> wrote in message
    > news:3f001368$0$288$...
    > > Hi,
    > >
    > > Might be a stupid question but bear with me. I feel newbie since I

    plunged
    > > into HTML 4.01... I'd like a DIV to contain an image to the right side.

    > The
    > > image should set the DIV maximum height. If the contained text inside

    the
    > > div overflows, the DIV should scroll vertically. Can I achieve this?

    >
    > Yes and no. It will require using CSS as well and it will be a lot easier
    > if you know the dimensions of your picture. If you don't know the size,
    > you'll have to make some compromises about your design and settle for
    > something similar to what you want.
    >
    > In the following examples, I'll assume that the picture is 100px wide and
    > 200px high. I'll also be using inline CSS via the style attribute and

    that
    > unless otherwise specified, that the margin, border and padding of all
    > elements have been set to 0px.
    >
    > Scenario 1: You want the picture at upper right. and don't care where the
    > text goes.
    >
    > <DIV style="height:200px;overflow:auto">
    > <IMG style="float:right">
    > Your text here.
    > </DIV>
    >
    > If you want the scrollbar to always be there you'd use overflow:scroll
    > instead.
    >
    > Scenario 2: You want the picture at the upper right, but you don't want

    the
    > text under the picture.
    >
    > <DIV style="height:200px;overflow:auto">
    > <IMG style="float:right">
    > <DIV style="margin-right:100px">
    > Your text here.
    > </DIV>
    > </DIV>
    >
    > Scenario 3: You want the picture at right and for it to stay visible and

    in
    > place as the text scrolls.
    >
    > <DIV>
    > <IMG style="float:right">
    > <DIV style="height:200px;overflow:auto;margin-right:100px">
    > Your text here.
    > </DIV>
    > </DIV>
    >
    Vince C., Jul 1, 2003
    #2
    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. xxfiredragonxx
    Replies:
    0
    Views:
    600
    xxfiredragonxx
    Dec 19, 2005
  2. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    743
  3. Mark B
    Replies:
    1
    Views:
    376
    Alexey Smirnov
    Feb 9, 2010
  4. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    185
    David Dorward
    Jun 1, 2005
  5. benjamin
    Replies:
    2
    Views:
    119
    benjamin
    Nov 16, 2005
Loading...

Share This Page