Help - Search - Members - Calendar
Full Version: text alignment problem in explorer
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
jonathan shepherd
I'm having a problem aligning my text in internet explorer, it works fine with firefox but when i use explorer the text is aligned left when it should be center. The html is align= center but explorer keeps aligning it left. One thing that does happen in explorer is when i click on the page the text shifts to center where it should be but it will not open in the right position, what am i doing wrong and why is it all ok in firefox.
pandy
QUOTE

The html is align= center


Used with what? Can you post the URL to the page, please?
jonathan shepherd
url is http://derbyshireartist.tripod.com the problem is with the alignement of the titles at the top of the page.
pandy
OK. You have some errors. smile.gif
http://www.htmlhelp.com/cgi-bin/validate.c...s&input=yes


I guess the problem is this.
CODE
<p align="center"><font face="Times, Times New Roman" size="6" color="#CCFFCC"><b><h1>DERBYSHIRE PRINTS FROM ART OF THE COUNTRY</h1></b></font></p


A P cannot contain other block level elements, as for instance H1. It can only contain inline (text level) elements.
http://www.htmlhelp.com/reference/html40/block/p.html
I guess IE chooses to close the P when it encounters the H1.

You should look into CSS. You don't need to do anything fancy to start with, but if you used CSS just for text formatting you could get rid of all those FONT tags. The code becomes much easier both to write and read that way.
http://htmlhelp.com/reference/css/
pandy
B, an inline element, can't contain H1, a block level element, either. The same goes for FONT. You have to do it like this.

CODE
<h1 align="center"><font face="Times, Times New Roman" size="6" color="#CCFFCC"><b>DERBYSHIRE PRINTS FROM ART OF THE COUNTRY</b></font></h1>


Frankly, I think it looks nices with left aligned text. happy.gif

Darin McGrew
QUOTE
You have to do it like this.
Or just use
CODE
<h1>DERBYSHIRE PRINTS FROM ART OF THE COUNTRY</h1>
and use CSS for all the rest.
jonathan shepherd
QUOTE(Darin McGrew @ Mar 13 2008, 05:00 PM) *

QUOTE
You have to do it like this.
Or just use
CODE
<h1>DERBYSHIRE PRINTS FROM ART OF THE COUNTRY</h1>
and use CSS for all the rest.

Thanks to everyone, i'm learning as i go along, will look into the css.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.