Wrapping Text Around an Image Using HTML/CSS
Question:
Can you design a block of text to wrap around an image like this:
[Image of text wrapping around an image]
Answer:
Yes, this is possible by floating the image container.
HTML:
CSS:
#container{ width: 400px; background: yellow; } #floated{ float: left; width: 150px; background: red; }Explanation:
- The #container div defines the boundaries of the text and image.
- The #floated div contains the text that will wrap around the image.
- The float: left property on the #floated div makes it float to the left of the container.
- The width property on the #floated div defines how wide the text will be.
Live Example:
[JSFiddle](http://jsfiddle.net/kYDgL/)
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3