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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:30:51+00:00 2026-06-14T04:30:51+00:00

I have images with captions, like so: <figure class=imageBoxShadow> <img alt=Alt-Text src=http://lorempixel.com/280/375> <figcaption>A Caption

  • 0

I have images with captions, like so:

<figure class="imageBoxShadow">
    <img alt="Alt-Text" src="http://lorempixel.com/280/375">
    <figcaption>A Caption for this image</figcaption>
</figure>

The class “imageBoxShadow” puts a boxShadow (who’d have guessed?) around the image. I put it on the figure, because the caption is supposed to go inside the border. Which works fine as long as the caption is smaller then the image is wide.

However, if I have a small Image and/or a long caption the caption will extend the figure element as far as possible, which looks stupid.

Of course I could restrain the figure element by adding a hardcoded style to set the width:

<figure class="imageBoxShadow" style="width: 100px">
    <img alt="Alt-Text" src="http://lorempixel.com/100/150">
    <figcaption>Using a hardcoded style to restrict the figure element works but feels stupid.</figcaption>
</figure>

but that feels stupid and not very convenient in a CMS-context.

Is there a better way to do this?

Have a jsFiddle link to check it out: http://jsfiddle.net/Sorcy/h5sNB/

  • 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-14T04:30:52+00:00Added an answer on June 14, 2026 at 4:30 am

    add

    figure {
      display: table;
      width: 1px;
    }
    

    to your css [as proposed here ] and you’re done.

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

Sidebar

Related Questions

Here's my HTML: <div class=large> <img src=/images/photos/Interior.jpg alt=The interior style=[...] /> <div class=caption>The interior</div>
I really like this jQuery Slider : http://slidesjs.com/examples/images-with-captions/ However, instead of 1 image per
I have some rotating images with hidden captions that I'd like to expose with
I have html like this: <div> <span style=display: inline-block;height:20px>20</span> <span style=display: inline-block;><img src=img/ex.png/></span> </div>
I have code like this: <div class='outer'> <div class='imgwrapper'><img /></div> <div class='caption'>This is a
I have images in divs and I would like to have paragraphs to appear
I have this image link: <p class=alignright> <a target=_blank href=...> <img width=230 height=158 align=right
I am creating my first blog's template. I want to have inline images like
I'm trying to text-wrap floating images in LaTeX, using code like the following: \begin{wrapfigure}{R}{0.5\textwidth}
Curious problem. I have a set of images with some attributes that I'd like

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.