Solved

How to left-align a pic in XHTML + CSS

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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 receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

762 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now