Focus

This is the blog for my web design, development and marketing company, Red Kite Creative. Mostly what I'll be writing about is work-related but anything is fair game. Read more about me here...


View Debbie Campbell's profile on LinkedIn

What I'm Reading



View my bookstore













Easy image alignment within HTML text

January 18th, 2007 by debbie campbell

Want to be able to drop images into your HTML with a minimum of effort? Set up two little classes in your CSS file to do just that.

1. Open your CSS file.

2. Add in a new class like so: img-left {float: left; padding: 8px 8px 8px 0;}

3. Add in another new class: img-right {float: right; padding: 8px 0 8px 8px;}

(Note: Change the padding as you see fit, this is just a suggestion!)

4. Within your markup, add in your image just in front of the text and then put a div with a class of “img-left” or “img-right” around it depending on whether you want your image to the left or right of your flowed text.

mountains at sunset
mountains at sunset

Here’s an example of this in action using “img-left.”

Posted in Timesavers, Web Design |

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment a bit. Please stay on topic. If you submit spam or irrelevant comments, it will be deleted and your IP will be banned.