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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.