HTML5 Wrap Text Around Image With Caption - Stack Overflow

Just browsing Stack Overflow? Help us improve your experience. Sign up for research
    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 ago Modified 11 years 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.

  • Featured on Meta
  • We’re (finally!) going to the cloud!
  • More network sites to see advertising test [updated with phase 2]

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? 153 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

  • A Title "That in Aleppo Was"
  • Apple falling from boat mast
  • Most Efficient Glide: Pitch Up or Level Flight to Bleed Airspeed
  • Why is this soldering iron red hot in the middle section?
  • Does the 90 day window for VWP reset for extended stay in Mexico?
  • Line breaks do not fit well in mathmode
  • What is the proper way to say "voice direction" in German?
  • Is it necessary to have a hood if soldering with lead-free solder?
  • Have import tariffs ever been good for an economy historically?
  • How to inflict self damage anywhere in Fallout 2?
  • Why is the chi-square test giving unintuitive results?
  • Reality check: energy source for power armour
  • Connectedness of intersection of two sets
  • Custom document class always pick the default logo even if I change to other logos
  • How can I get more space between the contents of a bNiceArray and the enclosing brackets?
  • Are garbage-collection programming languages inherently unsafe for use in cryptography
  • Is Trinitarian Christian theism a simple hypothesis?
  • What is the name of the lady with the white blouse?
  • will "brown aluminum" drip-edge suffer galvanic corrosion if it rests against fascia made of copper-treated lumber?
  • List of all sequences with certain properties
  • Map or Thread operation for list
  • How do you write a page-centered abstract in a two column document
  • How to demystify why my degree took so long on my CV
  • When my modem places a signal on coax, is that signal still considered Ethernet?
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