Solved

How to left-align a pic in XHTML + CSS

Posted on 2007-04-06
3
731 Views
Last Modified: 2013-11-19
I want to display an image on my page, and have text "wrap around" the image, with the image on the left side of the text.  I am using XHTML 1.1 Strict.  I have this line in my HTML:
<div id="centerpic"><img src="images/parchment_compass_world_map.jpg" alt="Parchment Map" width="228" height="150"/></div> MY TEXT HERE

and my css reads:
#centerpic {
      text-align: left;
      }      

but this is not working.  The image shows up fine, but text is still going under the image, and I want text to go to the right of the image, wrapped.  If I put MY TEXT HERE inside the DIV tag, it will put the text to the right of the image, but at the very bottom and to the right.  I need the text to begin off the upper right corner of the image, not the bottom right corner.  
0
Comment
Question by:arthurh88
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
opho earned 500 total points
ID: 18868003
Hey arthurh88....

What you're looking for is

#centerpic {
float:left;
}

You'll probably want to set margin-right: 8px; or however large works for you.

--Steve
0
 
LVL 4

Expert Comment

by:opho
ID: 18868005
Or, actually, (sorry I missed this part) if the picture is to appear on the right side, its

float:right

and you'll want to set margin-left: 8px or so.

--Steve
0
 

Author Comment

by:arthurh88
ID: 18868014
thanks!  thats it
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question