TheFilmGod Posted July 28, 2007 Share Posted July 28, 2007 How can I make text become treated like a normal div tag? I want a small image at the end of it. But if I float the image to the left it makes a new line and is floated to the parent div. I want it to float to the left of the text. So how do I make the text become treated like a div? Quote Link to comment https://forums.phpfreaks.com/topic/62201-text-into-display-block/ Share on other sites More sharing options...
AndyB Posted July 28, 2007 Share Posted July 28, 2007 span or p seem like reasonable approaches Quote Link to comment https://forums.phpfreaks.com/topic/62201-text-into-display-block/#findComment-309619 Share on other sites More sharing options...
dbrimlow Posted July 28, 2007 Share Posted July 28, 2007 To further expand upon what Andy suggested, you should ALWAYS have text contained within a block level tag - paragraph, header, list, etc. Never just leave text flappin' in the breeze with only a div or span. If you put your text in a p tag, then create a style for an image within the p tag - something along the lines: p img {float:left; margin:.25em} This way, you can put the image within the p tag itself. The same goes for a list item. For example, here is a list item with a photo floated left in one of my sites: <li> <a href="http://www.manhattanlofts.com" target="_blank"><strong>manhattanlofts.com</strong><em>Residential Lofts in NYC </em><img src="images/manlofts.png" alt="Image" height="123" width="150">An Advanced Business site with dynamic database, advanced custom coding, client interface data mgmnt screens, Art Director. W3C valid web code. </a> <hr> </li> The css for the img tag is: #sidecol img { float: left; margin: 5px 10px 5px 5px; padding: 3px; border: 1px solid #28AAB9; } Quote Link to comment https://forums.phpfreaks.com/topic/62201-text-into-display-block/#findComment-309792 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.