Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8170845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:16:07+00:00 2026-06-06T21:16:07+00:00

I have the follow html structure: <div id=container> <div id=block1> <img src=someimage/path /> </div>

  • 0

I have the follow html structure:

<div id="container">
    <div id="block1">
        <img src="someimage/path" />
    </div>
    <div id="block2">
        Some Text
    </div>
    <div id="block3">
        Some Text
    </div>
</div>

the container is float:left. The container will stretch out to the widest div, but what if i only want it to follow block1, and have block2 and block3’s text to wrap according to how big the image in block1 is. For my markup right now, if the text is long it will push out the container div as far as the text goes out, but I want the text to only be as wide as the image, almost like an image caption. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:16:09+00:00Added an answer on June 6, 2026 at 9:16 pm

    Make the container display:inline-block; with overflow:auto; so that it automatically stretches to fit the content. Give Block #2 and Block #3 overflow:auto; too so that they stretch to fit their content.

    Unfortunately, you need to use JavaScript to get the width to be the width of the image. See my example below, where I fix it with jQuery.

    See: http://jsfiddle.net/TFLMX/2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following structure. <div> <p>Hello World !!</p> </div> <iframe id="myiframe" src='myiframeContent.html'></iframe> and
I have the follow structure: <div class=cardapio-content> <h5>Tittle of tab 1</h5> <p>Content of tab
I have HTMl structure as follows <div class=comments_options id=comment_2> <span>2 comments</span> </div> In Mootools
I have a HTML structure like follows <div id=answer-1> <a class=edit></a> </div> <div id=answer-2>
If I have a drop down list as follows <div class=editor-label> <%= Html.DropDownListFor(model =>
I have the follow structure (example): trunk/ branches/v1.0.0 branches/v1.0.1 tags/v1.0.0 My question is: The
I have the following DOM structure: /*:DOC += <div id='testDiv' class='testDivClass'><div id='innerTestDiv'></div></div><span id='testSpan' class='testSpanClass'><span
I have a html structure like so [list within a list]: <ul class=outer >
At the site I'm developing , I have some div s which are loaded
In my database, I have some tables which have the same structure as Folders

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.