Jump to content

Text into Display Block?


TheFilmGod

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/62201-text-into-display-block/
Share on other sites

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; 
}

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.