Featured Content Check It Out:

Don't Let Failure Get You Down Avaoid The Things That Will Kill Your Blog Brand Your Blog This Is A Do Follow Blog Make Your Blog More Personal

Image Positioning In Blog Posts - A Tutorial

Permalink 06:15:16 am, by blog_angel Email , 2334 words
Categories: Blog Promotion, Layout & Design

I recently had a request from one of my regular readers, Marg who presides over the most excellent Marg's Pets blog. It seems that Marg is feeling a bit unsure about getting images positioned on her blog. I can understand this, as many bloggers have little or no experience with the HTML and CSS code used to get their blog posts to render in a browser. So today I am going to give those of you who are interested, a little crash course on how to position images in your blog posts. Of course, not all blogging software is the same, so I will keep this very general. But I think you'll be able to figure it out.

Follow up:

At the end of this post, you will find a download of the tutorial as a PDF file so you can save it on your hard drive for future reference. I also am including a quick reference HTML page that you can open in your browser, in another tab or window while you are creating your posts. You can then easily copy and paste the code snippets you will need to position your images. Okay, shall we get started?

Let's say that you wanted to get an image centered in your blog post, just like the one above. First you need to insert an image. It is a common practice to insert the image above the first paragraph of a blog post. This way it appears at the very top of your post. Alternatively, you can insert an image between two paragraphs in your blog text.

To see the markup code that directs the browser where to find the image to display, you will need to have your blog editor in HTML or Source mode. An inserted image should appear similar to the one below:

<img src="http://www.sxc.hu/pic/m/m/mi/mikkolo/1082634_sheep_on_grazing_ground.jpg" />

Your inserted image might have more code around it or in it, especially if it is linked or if it includes a title or alternate text. You don't need to worry about that. What you are looking for is the part that looks like this <img. I am going to give you a snippet of text to insert after that part of the code. That little line is what will center the image for you. The code you will be inserting is this:

style="display:block;margin:0 auto;"

So when you insert the above snippet of code after <img the code for the centered image above it looks just like this:

<img style="display:block;margin:0 auto;" src="http://www.sxc.hu/pic/m/m/mi/mikkolo/1082634_sheep_on_grazing_ground.jpg" />

That's it no magic no lengthy explanation. You don't need to understand why this works, just use the snippet of code. Insert it after <img and leave a space before and after the snippet. Just like in the example above.

Positioning An Image To The Right

Now we're going to try something a little bit trickier. We're going to take an image and position it to the right of our text, just like in the example below. The instructions begin after the example image and paragraph. I just used some dummy filler text for our demonstration. So skip down to where it says Image Right Example.


This is dummy text for our example. I don't have anything to say, not really, but to see how this right floated sheep was accomplished check out the next paragraph. Facilisi euismod dignissim praesent nulla, enim duis lobortis. Quis dolor, quis consequat eu enim iusto facilisis nisl in eu ea ut. Lobortis volutpat feugait ut hendrerit te, vero te delenit et, suscipit te aliquam feugait, dolore euismod. Vel nonummy sed sit iusto, qui vel suscipit facilisi aliquip, ea ullamcorper nulla vel ex duis nulla. Dignissim vulputate nibh in, feugiat autem adipiscing suscipit qui, at consectetuer et dolore veniam nibh feugait facilisis. Aliquip eros et adipiscing illum blandit aliquip ex facilisis ad facilisi aliquip illum blandit, dignissim ullamcorper odio eu hendrerit blandit esse. Eum exerci nostrud feugiat hendrerit et facilisis delenit dolor praesent quis, ex delenit.d facilisi tation velit minim diam, veniam et ut odio sed commodo molestie. Ut iusto laoreet erat delenit illum, eros wisi adipiscing, nisl tation accumsan. Sit in, lobortis erat feugiat eros, consequat at ut diam, exerci elit sit enim at et nulla lobortis nulla dolor.Aliquip eros et adipiscing illum blandit aliquip ex facilisis ad facilisi aliquip illum blandit, dignissim ullamcorper odio eu hendrerit blandit esse. Eum exerci nostrud feugiat hendrerit et facilisis delenit dolor praesent quis, ex delenit.d facilisi tation velit minim diam, veniam et ut odio sed commodo molestie.

Image Right Example - This isn't that much harder than centering an image, but there is a little more to it, so pay attention. Here is the new code snippet you will need to send an image to the right of the paragraph text:

style="margin:0px 0px 5px 10px;float:right;clear:right;"

You are going to do the exact same thing with this snippet as you did with the one for centering an image. Insert it right after the <img part of the tag with a space before and after the snippet. It will look much like this.

<img style="margin:0px 0px 5px 10px;float:right;clear:right;"
src="http://www.sxc.hu/pic/m/m/mi/mikkolo/1082634_sheep_on_grazing_ground.jpg"
/>

I would love to tell you that this is all you need, but I did warn you that there was a little more to it. The code used to insert your image must be included between the paragraph tag and the beginning of your paragraph text. You will have to be in HTML or Source editing mode in your blog editor to see where the paragraph tag is. You will be inserting the code for the image to be included, right after the paragraph tag <p>, not hard to spot seeing as how it is the letter "p" surrounded by angle brackets. So the code for the above looks like this:

<p><img style="margin: 0px 0px 5px 10px; float: right; clear: right;" src="http://www.sxc.hu/pic/m/a/an/andrewp001/1228127_baby_lamb.jpg" />This is dummy text for our example. I don't have anything to say, not really, but to see how this right floated sheep was accomplished check out the next paragraph. Facilisi euismod dignissim praesent nulla, enim duis lobortis. Quis dolor, quis consequat eu enim iusto facilisis nisl in eu ea ut. Lobortis volutpat feugait ut hendrerit te, vero te delenit et, suscipit te aliquam feugait, dolore euismod. Vel nonummy sed sit iusto, qui vel suscipit facilisi aliquip, ea ullamcorper nulla vel ex duis nulla. Dignissim vulputate nibh in, feugiat autem adipiscing suscipit qui, at consectetuer et dolore veniam nibh feugait facilisis. Aliquip eros et adipiscing illum blandit aliquip ex facilisis ad facilisi aliquip illum blandit, dignissim ullamcorper odio eu hendrerit blandit esse. Eum exerci nostrud feugiat hendrerit et facilisis delenit dolor praesent quis, ex delenit.d facilisi tation velit minim diam, veniam et ut odio sed commodo molestie. Ut iusto laoreet erat delenit illum, eros wisi adipiscing, nisl tation accumsan. Sit in, lobortis erat feugiat eros, consequat at ut diam, exerci elit sit enim at et nulla lobortis nulla dolor.</p>

Some editors automatically assume a line break is the end of the paragraph and don't visually use tags, but they will let you insert them in HTML/source mode. Simply type them in so they surround your image code and your paragraph text (just like in the example above). You only need to do this for paragraphs that you want to position an image next to.

So if your blog editor is in HTML/source mode and you don't see a <p> at the beginning of your paragraph and a </p> at the end, you will have to add them. Type the beginning tag <p> before the inserted image and type the closing paragraph tag </p> at the end of the paragraph text. Note that the tag at the end has a slash before the letter "p". This is the one under the question mark on your keyboard. Don't leave out the slash on the tag at the end or you may really confuse the browser when it tries to display your post. Examine the example above to get a better grip on what you are going to be doing.

An Image To The Left

Now we are going to make a few changes to our snippet, and position an image to the right of our text. Skip down to the Image Left Example below for all the details.

This is dummy text for our example. I don't have anything to say, not really, but this is the example of how to posistion an image to the left of a paragraph. Facilisi euismod dignissim praesent nulla, enim duis lobortis. Quis dolor, quis consequat eu enim iusto facilisis nisl in eu ea ut. Lobortis volutpat feugait ut hendrerit te, vero te delenit et, suscipit te aliquam feugait, dolore euismod. Vel nonummy sed sit iusto, qui vel suscipit facilisi aliquip, ea ullamcorper nulla vel ex duis nulla. Dignissim vulputate nibh in, feugiat autem adipiscing suscipit qui, at consectetuer et dolore veniam nibh feugait facilisis. Aliquip eros et adipiscing illum blandit aliquip ex facilisis ad facilisi aliquip illum blandit, dignissim ullamcorper odio eu hendrerit blandit esse. Eum exerci nostrud feugiat hendrerit et facilisis delenit dolor praesent quis, ex delenit.d facilisi tation velit minim diam, veniam et ut odio sed commodo molestie. Ut iusto laoreet erat delenit illum, eros wisi adipiscing, nisl tation accumsan. Sit in, lobortis erat feugiat eros, consequat at ut diam, exerci elit sit enim at et nulla lobortis nulla dolor.

Image Left Example - Like I mentioned, this is very similar to sending an image to the right of your paragraph text. Here is the new code snippet you will need to send an image to the right of the paragraph text:

style="margin:0px 10px 5px 0px;float:left;clear:left;"

Insert this code in the same place as you would for the image right example, right after the <img part of the html code, making sure that your image is inserted inside the paragraph, right after the <p> paragraph tag.

that we have only made a few changes from the snippet used to send an image right. The float and clear values have each been changed from "right" to "left". I also adjusted the values for the margins surrounding the image.

I want to take a moment to mention the margin values and what they are included for. If we didn't set some margins, the image and the text would butt up against each other in a very unattractive way. The numbers after the margin selector push the text away from the image. For reference purposes the values are set in the following order:

margin: top right bottom left;

You can change the numbers in the code snippets if you want to increase or decrease the amount of space between the image and the text. But the settings I used seem to strike a pleasing balance. As for the centered example, you won't see any margins in the HTML code snippet. That's because it is inserted between two paragraphs. And paragraphs, by default, already have top and bottom spacing added to them. So you can get away without adding margins on centered images if they are inserted between, instead of in paragraphs.

The instructions for where to place the code for a right floated image are exactly the same as were for a left floated image. So the code for the above left floated image example would look like this:

<p><img style="margin: 0px 0px 5px 10px; float: right; clear: right;" src="http://www.sxc.hu/pic/m/a/an/andrewp001/1228127_baby_lamb.jpg" />
This is dummy text for our example. I don't have anything to say, not really, but this is the example of how to posistion an image to the left of a paragraph. Facilisi euismod dignissim praesent nulla, enim duis lobortis. Quis dolor, quis consequat eu enim iusto facilisis nisl in eu ea ut. Lobortis volutpat feugait ut hendrerit te, vero te delenit et, suscipit te aliquam feugait, dolore euismod. Vel nonummy sed sit iusto, qui vel suscipit facilisi aliquip, ea ullamcorper nulla vel ex duis nulla. Dignissim vulputate nibh in, feugiat autem adipiscing suscipit qui, at consectetuer et dolore veniam nibh feugait facilisis. Aliquip eros et adipiscing illum blandit aliquip ex facilisis ad facilisi aliquip illum blandit, dignissim ullamcorper odio eu hendrerit blandit esse. Eum exerci nostrud feugiat hendrerit et facilisis delenit dolor praesent quis, ex delenit.d facilisi tation velit minim diam, veniam et ut odio sed commodo molestie. Ut iusto laoreet erat delenit illum, eros wisi adipiscing, nisl tation accumsan. Sit in, lobortis erat feugiat eros, consequat at ut diam, exerci elit sit enim at et nulla lobortis nulla dolor.</p>

Okay, all done. Below is a quick reference guide for you to copy and paste your positioning code snippets from.

For quick reference:

1. Centering an image, insert this snippet:

style="display:block;margin:0 auto;"

right after the <img section with a space before and after the snippet.


2. To position image to the right, insert this snippet:

style="margin:0px 0px 5px 10px;float:right;clear:right;"

right after the <img section with a space before and after the snippet. The inserted image should be inside of (to the right of) the opening <p> tag for the paragraph that you want the image to float away from.


3. To position image to the right, insert this snippet:

style="margin:0px 0px 5px 10px;float:right;clear:right;"

right after the <img section with a space before and after the snippet. The inserted image should be inside of (to the right of) the opening <p> tag for the paragraph that you want the image to float away from.


I really hope this helps more than it confuses. I tried to keep it simple and used real examples to illustrate what I am trying to communicate. And as promised you can download the PDF and HTML files here:

image_positioning_tutorial.zip

Best thing to do until you get the hang of it, is to keep the HTML copy open in another browser tab or window so you can reference it. Just copy and paste the snippets as needed.

Now if I didn't scare you away with this tutorial, how about learning to add borders, padding and a background color? You would learn how to get an effect like this:

Should I prepare a tutorial for this too? I don't mind putting in the work if someone is going to actually be able to use the info. As always leave your comments and let me know what you think.

Humbly Yours,

Blog Angel (Sometimes called Joella)

15 comments

Comment from: Man Over Board [Visitor] · http://man-over-board.com
Yes tell us. I want to be able to do all kinds of boarders and colors around my pictures. Can you also teach us how to do a wooden boarder like a nice old time frame for pictures too. Oh and a chrome one. How about a shadow off to the left or right?

I know lots of requests, my mom always said if you don't ask you never get, so hey I thought I'd ask and get at least one :-)
11/28/09 @ 10:22
Comment from: blog_angel [Member] Email
@Man Over Board - You are like a demanding child, but you are a dear and valued friend. So I will continue to indulge your clamorous cries for attention :)

I am not offering to teach you graphics/image editing, only some simple HTML/CSS stuff. Which I know can be difficult for bloggers who have no such background. You, I believe, have such a background. Naughty boy.
11/28/09 @ 10:33
Comment from: David B Katague [Visitor] · http://lifeinus1960present.blogspot.com
Very informative post. Thanks, Angel!
11/28/09 @ 11:07
Comment from: blog_angel [Member] Email
@David B Katague - You are very welcome. I hope this is information that you will be able to put to use. I will be following up with a tutorial on adding a background color and a border to images soon. So stay tuned.
11/28/09 @ 11:45
Comment from: David B Katague [Visitor] · http://lifeinus1960present.blogspot.com
Could I link this posting in my blog above. Do you have a CREATE A LINK ?
I tried to click on the permalink above, but it does not seem to work.
11/28/09 @ 12:28
Comment from: blog_angel [Member] Email
@David B Katague - Of course you can link to this post. I have emailed you the link and text to include on your blog. I believe if you right click on the link, your browser should give you the option to copy the link location. But if not I have sent it to you. Glad you find it worthy of being shared!
11/28/09 @ 19:33
Comment from: Marg [Visitor] · http://www.margsanimals.com/blogs
Wow, glad you did something I can download. That is going to take me some time to learn how to do it. But I have time to study since my blog is still down at the moment. I think I have a question but I will wait til I read all this again. Oh and thanks so much for the nice mention of the pet blog.
11/29/09 @ 06:31
Comment from: blog_angel [Member] Email
@Marg - I know it looks a little complicated, but you'll get the hang of it. You can't break anything. Always check out your results in preview mode first and if it doesn't work, go back and try to figure out why. Experiment, try it out and just take it one step at a time. If you have questions, just email me and I'll give you a hand, but wait til Wednesday or later. Moving is such a pain ;)
11/29/09 @ 06:43
Comment from: Your Daily Cute [Visitor] · http://www.yourdailycute.com
I love the sample images! ;)
11/29/09 @ 19:03
Comment from: blog_angel [Member] Email
@Your Daily Cute - Flock 'o sheep go middle, left looking lamb go left, right looking lamb go right...

I was feeling kinda "sheepish" when I wrote the tutorial. :)
11/30/09 @ 06:41
Comment from: Change of Address [Visitor] · http://www.movers-edge.com/Change-of-Address-s/35.htm
I want to thank you very much this tutorial. I don't know if others found it too basic, but for me, I needed this information BADLY. I have really wrestled with getting my own graphics positioned correctly.
12/03/09 @ 15:01
Comment from: Change of Address [Visitor] · http://www.movers-edge.com/Change-of-Address-s/35.htm
And just as a side note, being new to the blog I just have to ask- what the heck is the deal with all the sheep??? :-)
12/03/09 @ 15:08
Comment from: blog_angel [Member] Email
@Change of Address - I am so glad that people are actually finding the tutorial useful. I was sure this information was easy to find, but I realized that was mostly not available in a context aimed at primarily bloggers. So it is very rewarding to find out I was right.

Aaaaah yes, the sheep. I was feeling a little "sheepish" as I wrote this tutorial, but I don't feel so baaaaaaaaaahd, now that I know people like you are finding it useful. Sometimes a tutorial makes big promises, but doesn't deliver. I was aiming to make sure that no one got "fleeced".

You have no idea how much I wanted someone to "bleat" out something about all the sheep. I am an incurable punster :)
12/03/09 @ 18:23
I would humbly suggest you could show the importance of putting a h2 h3 in a blog post with the main keyword so people actually find your blog page on google and such. And great info on the image positioning.
12/07/09 @ 00:21
Comment from: blog_angel [Member] Email
@MakK - Great suggestion about the keywords and headings. I will soon be publishing a multi-part article series on keywords. When I talk about keywords and headings, I will mention you suggested I pay special attention to this and link back to your site.
12/07/09 @ 07:09

Scroll down to leave a comment!
Blog Angel wants to know your opinon!

Check this recent content for more great articles!

Looking for FREE content?
You can embed and host this article on your blog right now! Click the button below and follow the instructions.

Show you care, please share!

Bookmark and Share

Let's Stay Connected!
Sign Up Now For Free Updates!

Email Address:

Powered by Feed My Inbox

OR - Follow With Bloglovin'

bloglovin

OR - Subscribe In A Reader

Subscribe

OR - Listen To Mobile Feed

Linked button to mobile podcast feed.

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
:!: :?: :idea: :) :D :p B) ;) :> :roll: :oops: :| :-/ :( :'( |-| :>> :yes: ;D :P :)) 88| :. :no: XX( :lalala: :crazy: >:XX
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)

Search


MyFreeCopyright.com Registered & Protected

Dropzone
SponsoredTweets referral badge

Who's Online?

  • Guest Users: 17

This Is A DoFollow Blog!

U COMMENT
I FOLLOW

How Can Commenting Here Help Your Blog?

Ad
b2

Creative Commons LicenseBlogs With Wings - Blog Articles by Joella Molson is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License. You may use my articles on your site if you provide a link and citation as required by the license.

Get Your Free RSS Updates VIA Email!

Email Address:

Powered by Feed My Inbox

Who The Heck Is Blog Angel?

Hi I'm Blog Angel a.k.a. Joella. I've learned so much in my blogging journey and I wanted to share that with others. To that end, I started Blogs With Wings, a place where bloggers can find help and resources to create their own successful blogs. Read More...

Comment & Join The Conversation

Blog Angel Recommends These Free Online Tools For Bloggers

Link Popularity Tool - AddMe

Web Page Analyzer - Free web page analysis tool calculates page size, composition, and download time. Gives speed recommendations based on best practices for usability, HCI, and website optimization.

Text analysis get keyword density counts for article posts and more.

Sitemeter.com

Page Rank Checker
Page Rank Checker is a free tool to check the page rank of any web site easily, without the need to install Google toolbar. This tool also allows you to display the page rank value of your web site right on your web pages.


King Ping is a pinging service that makes pinging faster and easier for bloggers and online publishers. They ping 121 web services for you.

Get notified for free when you site goes down with host-tracker.com

trace  reverse lookup

b2