473,385 Members | 1,727 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,385 software developers and data experts.

Centering an image in the middle of a paragraph

This is an absurdly simple question. Suppose I have a paragraph which
contains an image (of an equation) and I'd like the image to be
centered in the middle of the paragraph with space above and below.
How do I do this within XHTML and/or stylesheets? I've search for the
answer but I get deluged with the same question in different contexts.
Plus the responses have been so different that I don't know which are
hack answers versus the "best" answer. Here's a sample piece of HTML
talking (about spacetime) showing what I've been trying:

---------------------------
<p> Spacetime, the set of all events, has a shape just like the points
on the surface of the earth have a shape. The shape of spacetime in GR
is determined by Einstien's field equation:
<br clear="all" />
<span style="text-align:center;"><img src="equation.gif" alt="field
equation" title="field equation" /></span>
<br clear="all" />
You are not expected to know what this equation means. Just know that
the "T" in this equation represents a matter and energy distribution,
the big
"G" and little "g" are related to the shape of spacetime, and the
lambda is a
number which used to be thought to be equal to zero but newer
measurements
suggest that it may be nonzero.</p>
-----------------------------

This doesn't seem to work under Netscape 7 for Solaris. I don't want
to treat the text above and below the image as two different
paragraphs because they aren't. They are logically connected.

Jason
Jul 20 '05 #1
1 3171
Jason Quinn wrote:
Suppose I have a paragraph which
contains an image (of an equation) and I'd like the image to be
centered in the middle of the paragraph with space above and below.
How do I do this within XHTML and/or stylesheets?

---------------------------
<p> Spacetime, the set of all events, has a shape just like the points
on the surface of the earth have a shape. The shape of spacetime in GR
is determined by Einstien's field equation:
<br clear="all" />
<span style="text-align:center;"><img src="equation.gif" alt="field
equation" title="field equation" /></span>
<br clear="all" />
You are not expected to know what this equation means. Just know that
the "T" in this equation represents a matter and energy distribution,
</p>
-----------------------------

This doesn't seem to work under Netscape 7 for Solaris. I don't want
to treat the text above and below the image as two different
paragraphs because they aren't. They are logically connected.


Define the image as block level, and set left and right margin to
auto, and the top and bottom margins to some acceptable value. I
suppose this is just an end run around your desire not to split the
paragraph, but it's better than the br element imho. Note that
MSIE/Win 5 sometimes chokes on images defined as block level.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #2

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

Similar topics

2
by: Greg Shannan | last post by:
I normally centre an image using a <p align="center"> ... </p> format, but I understand that this is "deprecated" in the latest standard in favour of styles. The problem is that I cannot find a...
19
by: George Ziniewicz | last post by:
.. I try to use CSS when possible, though I am still learning and don't maximize its use. In particular, I still use a table to provide for a centered image in a few slideshows (though table...
18
by: Heath | last post by:
Is it proper to center images in a <div> by using the text-align: center property? Or is there a better way?
2
by: kevinC | last post by:
Hello, I know most of you are probably going seeing positioning:absolute; and centering in the title and saying, oh no! not again! Do a google search! Actually, I've found many helpful...
17
by: Applebrownbetty | last post by:
Hi, I'd like to append/amend the following code from the Dreamweaver extension "Open Picture Window Fever" for the ability to center the PopUp window: By default, it allows the window to be...
3
by: John Pote | last post by:
1. Horizontal centering a <divin browser window. The current trend seems to be to place page content in a fixed width area in the middle of the browser window. How is this achieved? If I use a...
5
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
3
by: rsteph | last post by:
I'm using two divs to create a shadowed-box type effect. Within the top div I want to put an image. I can get the image to center right to left, but not top to bottom. I'm making a series of boxes,...
4
by: harryusa | last post by:
I am trying to center 2 images concentrically which are z-indexed to lay on top of each other making an image with a border from another image that has a transparent center. I need the images to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.