How to wrap the text around an image using HTML and CSS? Last Updated : 15 Jan, 2025 Comments Improve Suggest changes Like Article Like Report Here are three methods to make text around an image using HTML and CSS:1. Using Float PropertyThe float property is the traditional way to position an image and allow text to wrap around it. HTML <html> <head> <style> .image-left { float: left; margin-right: 15px; } </style> </head> <body> <img src="example.jpg" alt="Sample Image" class="image-left" width="200"> <p> This is a paragraph of text. </p> </body> </html> The image is floated to the left using float: left;, and the text wraps around it.Margin is added to the right of the image to prevent text from sticking too close.2. Using FlexboxFlexbox can also be used to create layouts where the text and image are aligned side-by-side. HTML <html> <head> <style> .container { display: flex; align-items: flex-start; } .image { margin-right: 15px; } </style> </head> <body> <div class="container"> <img src="example.jpg" alt="Sample Image" class="image" width="200"> <p> Smaple Para </p> </div> </body> </html> The container uses display: flex; to align the image and text in a horizontal layout.Margin is added to the image for proper spacing. 3. Using CSS GridCSS Grid is a modern and versatile method for creating layouts where text wraps around an image. HTML <html> <head> <style> .container { display: grid; grid-template-columns: auto 1fr; gap: 15px; } </style> </head> <body> <div class="container"> <img src="example.jpg" alt="Sample Image" width="200"> <p> This is a sample text </p> </div> </body> </html> The container uses grid-template-columns: auto 1fr; to define a two-column layout, with the image in one column and text in the other.The gap property adds space between the image and text. Comment More infoAdvertise with us Next Article How to wrap the text around an image using HTML and CSS? S sdutta203sagnik Follow Improve Article Tags : Web Technologies HTML CSS Web Templates CSS-Misc HTML-Misc +2 More Similar Reads How to Add Image in Text Background using HTML and CSS ? In this article, we will use HTML and CSS to set the image in the text background. To set the image in the text background, some CSS property is used. To add an image in the text background using HTML and CSS, create a container element (e.g., a `<div>`), set its background to the desired imag 2 min read How to Add Border to an Image Using HTML and CSS? Adding a border to an image means putting a line around the image to make it look better and more noticeable. To add a border to an image using HTML and CSS, we can use the <img> tag and apply CSS styles like border, border-width, and border color to customize the border's appearance.Syntax.im 1 min read How To Place Text on Image using HTML and CSS? To place text on an image using HTML and CSS, you can use different techniques to make the text look good and easy to read. Here, we will explore two approaches for placing text over an image using simple HTML and CSS.1. Using Absolute Positioning This approach uses absolute positioning to place the 3 min read How To Create a Thumbnail Image using HTML and CSS ? The thumbnail image is used to add a 1px rounded border around the image. A thumbnail is a small size image that represents a larger image. The thumbnail is the image that is displayed as a preview of the video. It is used to represent what the video contains or what it is related to. It is displaye 1 min read How to Add a Login Form to an Image using HTML and CSS? The login form on an Image is used on many websites. Like hotel websites that contain pictures of the hotels or some organizations that organize special events holding that event picture and login form. In that case, you can design a login or registration form on that picture. This design will make 2 min read Like