Click here to get back home

center a picture in the middle of a paragraph

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
center a picture in the middle of a paragraph Thomas Wesenigk 12-02-2004
Posted by Thomas Wesenigk on December 2, 2004, 10:14 pm
Please log in for more thread options
Hello,

I have a HTML like this:

[...]
<p style="text-align:left;">
[sometext]
[want to place a picture which is align=center here]
[sometext]
</p>
[...]

The problem is that the paragraph has a different background color than the
rest of the website. If I type something like this:
<div align="center">
<img...>
</div>
the paragraph ends graphically, that means the background color of the
website is used behind the picture and the following text is no longer
align=left.

The background color of the paragraph makes it to look like a box, and I
simply want to put the picture into this box.

Unfortunately I have no more ideas how to solve this problem.

Does someone have a good hint for me?

Thanks,
Thomas
(Germany)

--
Bitte in die Newsgroup antworten.
Bei eMail-Antwort muss "NGANTWORT" im Betreff enthalten sein.


Posted by Kris on December 2, 2004, 10:23 pm
Please log in for more thread options

> [...]
> <p style="text-align:left;">
> [sometext]
> [want to place a picture which is align=center here]
> [sometext]
> </p>
> [...]
>
> The problem is that the paragraph has a different background color than the
> rest of the website. If I type something like this:
> <div align="center">
> <img...>
> </div>
> the paragraph ends graphically, that means the background color of the
> website is used behind the picture and the following text is no longer
> align=left.
>
> The background color of the paragraph makes it to look like a box, and I
> simply want to put the picture into this box.
>
> Unfortunately I have no more ideas how to solve this problem.
>
> Does someone have a good hint for me?

<p>
Some text
<img>
More text
</p>

body {
color: #000;
background: #fff;
}

p {
color: #000;
background: #eee;
}

p img {
display: block;
margin: 0 auto;
}

--
Kris


Posted by Brian on December 2, 2004, 10:00 pm
Please log in for more thread options
Kris wrote:
>
>><p style="text-align:left;">
>>[sometext]
>>[want to place a picture which is align=center here]
>>[sometext]
>></p>
>
>
> <p>
> Some text
> <img>
> More text
> </p>
>
> body {
> color: #000;
> background: #fff;
> }
>
> p {
> color: #000;
> background: #eee;
> }
>
> p img {
> display: block;
> margin: 0 auto;
> }
>

I think you'd also need a hack for MSIE/Win, no?

p img {
display: block;
margin: 0 auto;
text-align: center; /* hack for MSIE 5.x win */
}

--
Brian (remove "invalid" to email me)


Similar ThreadsPosted
Center align a DIV without
tags
June 18, 2008, 9:43 am
Re: Text wrapped around a picture -- picture longer than text April 27, 2008, 10:40 am
Re: Text wrapped around a picture -- picture longer than text April 27, 2008, 7:29 pm
picture in navigation bar December 19, 2004, 6:30 pm
Why IE7 not displaying picture? November 11, 2006, 9:46 pm
Stretch DIV Tag From Middle? March 22, 2005, 2:34 pm
Multiple Links Per Picture June 16, 2005, 1:10 pm
Scrolling .jpeg picture in HTML? August 10, 2004, 6:26 am
counting link picture views February 16, 2005, 3:22 am
iFrame in middle of page April 12, 2005, 6:02 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap