HTML5 Wrap Text Around Image With Caption - Stack Overflow

Sorry, we no longer support your browser Please upgrade to Microsoft Edge, Google Chrome, or Firefox. Learn more about our browser support.
    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Labs
    7. Jobs
    8. Discussions
    9. Collectives
    10. Communities for your favorite technologies. Explore all Collectives

  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Get early access and see previews of new features.

Learn more about Labs HTML5 wrap text around image with caption Ask Question Asked 11 years, 1 month ago Modified 11 years, 1 month ago Viewed 7k times 0

How do i wrap text around an image with image caption.

i did in the following way, but the caption not coming properly.

<html> <head> <style> .textWrap{ float:left; margin:10px; } .textWrap p{ padding-top:3px; } </style> </head> <body> <figure> <img class="textWrap" src="img/index.jpg" /> <figcaption>Caption goes here</figcaption> </figure> <h6> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at ante. Mauris eleifend, quam a vulputate dictum, massa quam dapibus leo, eget vulputate orci purus ut lorem. </h6> </body> </html> Share Improve this question Follow asked Dec 4, 2013 at 4:56 user2629419's user avatar user2629419user2629419 4431 gold badge8 silver badges20 bronze badges Add a comment |

2 Answers 2

Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 1

I think you want to float the entire 'figure' element left, not the .textWrap image:

figure { float: left; margin: 10px 10px 10px 0; } Share Improve this answer Follow answered Dec 4, 2013 at 4:59 jhummel's user avatar jhummeljhummel 1,76414 silver badges23 bronze badges 4
  • tanks,its working fine. but how do i apply background for caption – user2629419 Commented Dec 4, 2013 at 5:02
  • I'm not sure exactly what you want it to look like: but here's a fiddle showing backgrounds on the entire figure and the caption: jsfiddle.net/jhummel/RGe4a/1 – jhummel Commented Dec 4, 2013 at 5:07
  • i want to apply background color only for caption not for entire image. is it possible – user2629419 Commented Dec 4, 2013 at 5:11
  • Sure: jsfiddle.net/jhummel/RGe4a/2 Just remove the background from the figure, and put a color on the figcaption element. Be advised, you should put display: block; on both figure and figcaption, as some older browsers like to display them inline. – jhummel Commented Dec 4, 2013 at 5:18
Add a comment | 0

Try using

.textwrap h6 { padding-top:3px; }

as there is no <p> tag in your code

Share Improve this answer Follow answered Dec 4, 2013 at 5:02 Crazy Programmer's user avatar Crazy ProgrammerCrazy Programmer 1961 gold badge3 silver badges18 bronze badges Add a comment |

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Draft saved Draft discarded

Sign up or log in

Sign up using Google Sign up using Email and Password Submit

Post as a guest

Name Email

Required, but never shown

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.

  • The Overflow Blog
  • How AI apps are like Google Search
  • WBIT #2: Memories of persistence and the state of state
  • Featured on Meta
  • The December 2024 Community Asks Sprint has been moved to March 2025 (and...
  • Stack Overflow Jobs is expanding to more countries

Linked

1 How to wrap text around figcaption 9 Image captions and wrapping 1 Wrap text around Image using CSS/JS 0 How to wrap text in image? 155 How to wrap text around an image using HTML/CSS 0 How to wrap text around image? 0 wrap text around an image in html and css 1 HTML wrap text around image in div 2 Have text wrap image 2 How to wrap text around image with CSS? 3 How to wrap text around an img in CSS?

Hot Network Questions

  • Is it a demotion when instead of reporting to a Director, I will report to a Sr Manager?
  • A miniature Thermometer Sudoku (ThermoDoku)
  • Identify a book or story where the protagonist(s) have a secret base on the island of Rockall?
  • What does "the ridge was offset at right angles to its length" mean in "several places where the ridge was offset at right angles to its length"?
  • Growing plants on mars to increase the oxygen level
  • Why do we define the standard error to ignore bias (unlike MSE which includes bias)?
  • Why does Bereishis Rabbah ask why Vaychi has no break?
  • Is this an effective way to quickly switch between two gain settings in an inverting amplifier configuration?
  • Are there any languages without adpositions?
  • Enforce SSH Private Key Passphrase Complexity
  • What do people mean when they say "Everything is connected"?
  • Should I include my legal name on my CV if my preferred name is not reflected on my diplomas?
  • How to Modify 7447 IC Output to Improve 6 and 9 Display on a 7-Segment
  • Ascon-128 cipher for 64-bits unique nonces
  • Are their any advanatges of a lower value of a loss function?
  • Understanding the benefit of non principal repayment loan
  • MAX3485 TTL to RS-485 Fake Chinese Modules. No output, wrong chip (Counterfeit?)
  • QGIS labeling: Why do we need a primary key for the auxiliary storage?
  • What Battery Powered Part Is This?
  • Does gravity from a star go through a black hole's event horizon to affect objects on the other side?
  • Canada's Prime Minister has resigned; how do they select the new leader?
  • Why are so many problems linear and how would one solve nonlinear problems?
  • Movie about dirty federal agents
  • Would the disappearance of domestic animals in 15th century Europe cause a famine?
more hot questions Question feed Subscribe to RSS Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-html

Từ khóa » Html Wrap Text Around Image With Caption