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 638259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:42:48+00:00 2026-05-13T20:42:48+00:00

I am trying to position a caption below an image without explicit knowledge of

  • 0

I am trying to position a caption below an image without explicit knowledge of the images’ width. I would like the caption to extend to the full image width, but not to stretch the parent elements’ witdh and wrap the lines instead.

I would like to avoid using javascript (reading and applying widths to elements) or using max-width:123px as the range of possible widths is big.

The code currently looks something like this, but can be changed freely. The image width is unknown, but restricted to a maximum dimension.

<div style="float:right; width:auto;">  
  <img src="http://" \>
  <div style="clear:right; min-width:100px; max-width:200px; word-wrap:break-word;">
    My caption which can be longer then the image above and should wrap, I do not want to use max-width.
  </div>
</div>

Any suggestions welcome.

  • 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-05-13T20:42:49+00:00Added an answer on May 13, 2026 at 8:42 pm

    first, get the styles out of the html; those belong in CSS.

    then, I think what you can do is set the div’s position to “relative”, but leave its width to auto and its overflow to “hidden”. The hidden setting should force it to be big enough for all its child elements.

    The caption, you then set to position:auto, and bottom:0, left:0, width:100%.

    That should accomplish what you’re looking for.

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

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The answer probably depends on how you are using your… May 16, 2026 at 2:36 pm
  • Editorial Team
    Editorial Team added an answer Here is a callback function I used for a drop… May 16, 2026 at 2:36 pm
  • Editorial Team
    Editorial Team added an answer It appears because jQuery uses its own event object instead… May 16, 2026 at 2:36 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

i'm trying to change the position of my image view after time delay like
I'm trying to extend the native geolocation function if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { var latitude
Is there an API call to determine the size and position of window caption
I'm trying to add a caption to a table in latex, however it throws
I'm writing a property editor for Delphi and I would like it to show
I have an image inside a span tag, the span has a set width
I'm trying to position my picture a little bit lower so the center of
I'm having a few problems trying to position some div s in my website
I'm trying to map a List with an index column. This works fine, but
We are trying to fill our Flex 3 applications background with an image pattern

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.