Image does not centre in preview

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
Tode
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 8
Joined: Wed Feb 02, 2005 4:30 pm
Location: London

Image does not centre in preview

Post by Tode »

I've tried various ways to centre an image which is not in a table but none of them seem to work in the preview window.
For example, defining a centre style and applying it to a <p>:

Code: Select all

 
defined in style section in head:
.cent
    {
    text-align:center;
    margin-top:0px;
    margin-bottom:0px;
    padding:0px;
    }
...
<p class="cent"><img  (etc.) ...></p>
This doesn't work in the preview window although it works in both Mozilla and IE6 and looks valid to me.
Tode

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3478
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

Hello Tode,

The integrated web browser uses the same engine as IE so if it works in IE, then it should work in the integrated web browser.

I created the following test document and the image did display in the center in the preview browser:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Test</title>
	<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
	<meta name="generator" content="CSE HTML Validator Professional (http://www.htmlvalidator.com/)">
<style type="text/css"><!--
.cent
    {
    text-align:center;
    margin-top:0px;
    margin-bottom:0px;
    padding:0px;
    }
--></style>
</head>
<body>
<p class="cent"><img src="http://www.htmlvalidator.com/jpg/box/box4_150.jpg"></p>
</body>
</html>
Please try the above and let me know if it works. I'd be surprised if it doesn't work. By the way, it was tested with IE 6.0 installed.

Tode
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 8
Joined: Wed Feb 02, 2005 4:30 pm
Location: London

Post by Tode »

Sorry! I forgot that you have to press the preview button on the inbuilt browser, i.e., when you close the browser window its temporary page remains open. I think I must have been looking at an old preview.
Thanks for checking.
Tode

Post Reply