How to wrap the text around an image using HTML and CSS? Last Updated : 15 Jan, 2025 Summarize Comments Improve Suggest changes Share 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. How to wrap the text around an image using HTML and CSS ? Comment More infoAdvertise with us Next Article How To Place Text on Image using HTML and CSS? S sdutta203sagnik Follow Improve Article Tags : CSS CSS-Misc HTML-Misc Similar Reads 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 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 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 How to create a Hero Image using HTML and CSS ? A Hero Image is a large image with text, often placed at the top of a webpage. Hero images can be designed using HTML and CSS. This article contains two sections. The first section attaches the image and designs the basic structure. The second section designs the images and texts on the images. The 2 min read How to create a Hero Image using HTML and CSS ? A Hero Image is a large image with text, often placed at the top of a webpage. Hero images can be designed using HTML and CSS. This article contains two sections. The first section attaches the image and designs the basic structure. The second section designs the images and texts on the images. The 2 min read Like