The text can not wrap around an image in the center. middle: It sets the alignment of image to the middle. The text-align property is used in CSS and certain HTML elements. You can also include spacing using CSS margins and a border using CSS border code. Place any minimal size image inside the div element and apply the CSS text-align:center for the div element. This method puts the image at the left or right of other content. Floating Left or Right. I should have added then set text-align: left on the first cell and text-align: right on the second one. center: Text centred within its containing box. [see CSS … Text can be centered in an HTML div and be left-aligned on the rest of the web page. You were not aligning an image independent of text. If you were to then give your CSS classes alignleft and alignright values of text-align: left; and text-align: right; respectively, you would get close to your desired result, but your right-aligned text would be bumped down one line because of the new paragraph. It sets the alignment of image to the left. don't float it). Since the image is specified first in the HTML order, the browser will have already, by this time, floated it to the left. Note: Due to the nature of slide-in text, you may need to refresh this page several times to catch all of the examples. (Please note that web pages set in certain languages, including Arabic, Hebrew, Persian, and Urdu, will have a different default orientation.) What I am trying to do, but am so-far failing miserably, is have a single DIV tag and within that DIV tag an image is aligned to the left, and some text is aligned to the right. Note: Due to the nature of slide-in text, you may need to refresh this page several times to catch all of the examples. Float left Put the text in the first cell and the image in the second. This was acheived by using float: right. How to select all text in HTML text input when clicked using JavaScript? It allows you to float an image left or right. It describes how inline content (eg. To do this we use the so-called floats (read about floats in the Bootstrap documentation).. -webkit-transition makes this animation work on browsers that uses Webkit rendering engines, this includes Chrome and Safari. By using HTML and CSS wrapping an image with the text is possible and there are many ways to do so because the shape of any image is not constant. How to make div width expand with its content using CSS ? These examples are the CSS version of those on the HTML slide-in Text page. Wrapping text around an image with CSS is easy. right: It sets the alignment of image to the right. p {text-align:left;} /* a generic styling rule for all p tags to align inner text left */ Just change ‘p’ to whatever selector you need. Notice how this and the other paragraphs above the source code box flow around the image. The difference is that the ones on this page are acheived using CSS animations (as opposed to the HTML