Solved

How to left-align a pic in XHTML + CSS

Posted on 2007-04-06
3
729 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

776 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