473,326 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

center a picture in the middle of a paragraph

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.
Jul 23 '05 #1
2 6189
In article <41***********************@newsread2.arcor-online.net>,
Thomas Wesenigk <th********@gmx.net> wrote:
[...]
<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
<kr*******@xs4all.netherlands> (nl)
Jul 23 '05 #2
Kris wrote:
Thomas Wesenigk <th********@gmx.net> 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)
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tim Streater | last post by:
I want to generate a web page using PHP, and in the middle generate a graphic I read from another server. So the graphic is in $picture. So I can either write $picture to a temp file and then use...
27
by: FL | last post by:
Hi Everyone, I know howto center a block using margin-left: auto ; margin-right: auto ; but I'm trying to center vertically a box, any idea to solve this?
10
by: john T | last post by:
Is there anyway to vertically center a html table using css in such a way it does not alter the html table. When I tryied it just screws up.
13
by: MrBaseball34 | last post by:
In this HTML: <html> <head> <title>Page 1</title> </head> <body style="background:#C2BFA5;"> <span style="background-color:#F9DFB2; position: absolute; border:thin inset;
0
by: PayPal | last post by:
<HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft DHTML Editing Control"> <TITLE></TITLE> </HEAD> <BODY> <STYLE type=text/css> ..dummy {} BODY, TD {font-family:...
2
by: Eric Lindsay | last post by:
If I want to have the middle of an image vertically aligned with the middle of a heading (or several lines of heading), is there some particular way people would recommend? vertical-align: center...
0
by: Werner Partner | last post by:
This page looks different now, but I show it how it looks like now: http://40296.webtest.goneo.de/matz-walter.de/ There are some little problems which have to do with another: If there is the...
8
by: Jonathan Sachs | last post by:
I'm trying to compose a list of items, each of which consists of text that wraps around a picture at the left margin. The examples I have seen tell me to do it like this: <p><img src="xxxx.jpg"...
7
by: raylopez99 | last post by:
I have a logical drawing space much bigger than the viewport (the screen) and I'd like to center the viewport (the screen) to be at the center of the logical drawing space. After following the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.