473,888 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6213
In article <41************ ***********@new sread2.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*******@xs4a ll.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
5232
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 an ordinary <img src=filename> to get the browser to display it, or output it by itself in a new page, because then I have a chance to output the correct header so I don't just get garbage on the screen. Evidently first approach is poor because...
27
9274
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
26891
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
14226
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
1547
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: verdana,arial,helvetica,sans-serif;font-size: 12px;color: #000000;}
2
12149
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 looked made for that. The effect I want is img heading img heading img heading or heading
0
1776
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 nice frame around the right cell, this cell is larger than the others. So I make the same frame around the left cell and it's ok. But now the middle cell is smaller. So I make a white cell around the middle cell. But this gas the effect that the...
8
2264
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" align="left" width=nn height=nn>zzz zzzzz zz zzzzz...</p> In my case, since the wrapped text includes a headline, I assume I am supposed to do this:
7
3570
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 excellent transforms specified on Bob Powell's site, I still wonder if there's an easier way of centering it than the following procedure? Here is what I do now (it's awkward but it works): 1) I follow the transforms specified on Bob Powell's...
0
9961
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9800
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9597
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7990
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5817
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4642
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4244
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.