DTP


 
Lively discussions on the graphic arts and publishing — in print or on the web


Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

Reply
 
Thread Tools Display Modes
Old 05-28-2006, 10:45 AM   #1
RJ Emery
Member
 
Join Date: Mar 2005
Posts: 248
Default Extraneous Blank Line Before <CENTER>

I have a private website, and within a paragraph there is one particular text line I wish to have centered. Using <CENTER> and </CENTER> to delineate the single line, I find that when the page is viewed, Mozilla and Firefox place a blank line before the single line of text while IE does not. I would prefer no blank line or breaks as is apparently the case with IE.

How might I overcome this deficiency?

<P>This is the beginning text<CENTER><FONT COLOR="#FF0000"><STRONG><I>while this is the one line to be centered</I></STRONG></FONT>,</CENTER>and these words represents the remaining text.</P>

   
__________________
RJ Emery, Eastern USA
WordPerfect 8 User on XP Pro SP3 System
OCR ScanSoft PaperPort SE v9 on
Brother MFC-8840DN Printer/Scanner/Fax
RJ Emery is offline   Reply With Quote
Old 05-28-2006, 11:35 AM   #2
Kelvyn
Staff
 
Kelvyn's Avatar
 
Join Date: Feb 2005
Location: In the Heart of the English Lake District
Posts: 1,381
Default

I'm afraid this is a bug in IE6. Firefox and Mozilla (and IE7 Beta2) display the code correctly. You can make the example you give to display in FF/Moz/IE7 as follows:

<p>This is the beginning text<div align="center" style="margin-top:-1em; color:#ff0000; font-style:italic;"><strong>while
this is the one line to be centered,</strong></div>and
these words represents the remaining text.</p>

However, now it will not display in IE6 correctly at all......

   
__________________
Kelvyn

Web site design, hosting and marketing, Keswick in the UK Lake District

If you are planning a visit to Keswick then try Keswick Tourist Information website

Kelvyn is offline   Reply With Quote
Old 05-28-2006, 12:17 PM   #3
iamback
Member
 
iamback's Avatar
 
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
Default

Quote:
Originally Posted by Kelvyn
I'm afraid this is a bug in IE6. Firefox and Mozilla (and IE7 Beta2) display the code correctly. You can make the example you give to display in FF/Moz/IE7 as follows:

HTML Code:
<p>This is the beginning text<div align="center" style="margin-top:-1em; color:#ff0000; font-style:italic;"><strong>while
this is the one line to be centered,</strong></div>and
these words represents the remaining text.</p>
However, now it will not display in IE6 correctly at all......
I'm surprised that would display "correctly" in Moz or FF: it's invalid code. a paragraph is a block but cannot contain any blocks - and a div is a block. Sounds like IE is right to not "display it correctly"! (Or do we have a case here of failing to be explicit? I see you use a margin - and different browsers use different margins. Setting only one margin and none of the others is sure to produce differences across browsers - and they could all be "correct".)

If it really needs to be a single paragraphs and a part of that centered, you could possibly put a line break before and after that "line" and put a span around the bit to be centered; though I doubt that would (or should!) work.

But I fail to grasp what structure could be represented by a single line within a paragraph that's sufficiently different to stand out and be centered - shouldn't it be three paragraphs to begin with? Of course once you arrive at that point, styling one of the three to be centered is really easy...

   
__________________
Marjolein Katsma
Look through my eyes on Cultural Surfaces (soon!), My ArtFlakes shop and Flickr.
Occasionally I am also connecting online dots... and sometimes you can follow me on Marjolein's Travel Blog
iamback is offline   Reply With Quote
Old 05-29-2006, 12:56 AM   #4
Kelvyn
Staff
 
Kelvyn's Avatar
 
Join Date: Feb 2005
Location: In the Heart of the English Lake District
Posts: 1,381
Default

Marjolein, my understanding of FF/Moz interpretation of <center> (which I assume is depracated) is that it is "assumed" to be a block element as is <div align="center"> - or at least, that is the way it seems to work. I have not seen any documentation about this, but I daresay you will know where to find it.

I know the style I set up is invalid, but the setting of a 1em negative margin-top demonstates the problem of trying to use a single paragraph. Like you, I believe that the example shown should have been in 3 <p> blocks, with the middle one center aligned.

   
__________________
Kelvyn

Web site design, hosting and marketing, Keswick in the UK Lake District

If you are planning a visit to Keswick then try Keswick Tourist Information website

Kelvyn is offline   Reply With Quote
Old 05-29-2006, 03:55 AM   #5
iamback
Member
 
iamback's Avatar
 
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
Default

Quote:
Originally Posted by Kelvyn
Marjolein, my understanding of FF/Moz interpretation of <center> (which I assume is depracated) is that it is "assumed" to be a block element as is <div align="center"> - or at least, that is the way it seems to work. I have not seen any documentation about this, but I daresay you will know where to find it.
<center> is definitely deprecated - browsers that have such a mode will surely be thrown into "quirks mode on encountering it.

If <center> is "assumed" to be a block (which it must be since inline elements cannot be centered!), then it ends the paragraph preceding it: a </p> will be "assumed" to precede the <center> element, and what comes after the <center> element is then no longer a paragraph, but part of whatever element surrounds it - which may in itself cause another error (since some elements may contain only blocks).
HTML 3.2 (which is where I look when enountering such ancient elements ) certainly defines <center> as a block element - like I said: it must be that!

You can test this implicit ending of the paragraph by setting a style on the paragraph, for instance with a different color or adding a border!

Without adding any styling, the only difference between "incorrect" or "undesired" (white space before) and "correct" (no whitespace before) rendering for <center> would then simply be a different implicit margin for the <center> element, coupled with whatever is implicit as bottom margin for a paragraph.

Quote:
Originally Posted by Kelvyn
I know the style I set up is invalid, but the setting of a 1em negative margin-top demonstates the problem of trying to use a single paragraph.
No, what it really demonstrates is that you cannot trust margins if you do not define them explicitly. Add an explicit bottom margin to the paragraph preceding it and then compare what you get in both browser classes.

   
__________________
Marjolein Katsma
Look through my eyes on Cultural Surfaces (soon!), My ArtFlakes shop and Flickr.
Occasionally I am also connecting online dots... and sometimes you can follow me on Marjolein's Travel Blog
iamback is offline   Reply With Quote
Old 05-31-2006, 04:56 PM   #6
dacoyle
Member
 
dacoyle's Avatar
 
Join Date: Aug 2005
Location: Arlington, VA (across the river from Washington, DC)
Posts: 560
Default

RJ,

Marjolein and Kelvyn are correct. <center> is a block level element, as is <p>, and you can't have a block within a block. Firefox is displaying the code correctly. However, I can't envision what you're trying to do and since it's a private site I understand you can't provide a link. If that particular information isn't private, could you take a screen shot in IE of how you want it to look? If that's not possible, could you duplicate the code with nonprivate info and get a screen shot?

   
__________________
Dennis
dacoyle is offline   Reply With Quote
Old 05-31-2006, 06:06 PM   #7
RJ Emery
Member
 
Join Date: Mar 2005
Posts: 248
Default

Dennis,

I already eliminated the leading sentence so a <center> would work. I would be happy to email you the website address so you could see for yourself. (How do I do that?) I just don't wish to make the site address known to all.

   
__________________
RJ Emery, Eastern USA
WordPerfect 8 User on XP Pro SP3 System
OCR ScanSoft PaperPort SE v9 on
Brother MFC-8840DN Printer/Scanner/Fax
RJ Emery is offline   Reply With Quote
Old 05-31-2006, 09:59 PM   #8
RJ Emery
Member
 
Join Date: Mar 2005
Posts: 248
Default

Dennis,

Many thanks for your comments.

I did not know about robots.txt, which has been placed in the top most directory. I thought as long as a site did not have www in its address, it did not get indexed by web crawlers. I also placed a corresponding <meta name="robots" content="noindex,nofollow"> in the index.html file.

I don't think I need to carry matters further at this point. We are trying to keep things as simple as possible, and I have a workaround in place. My thanks to you and all others who contributed herein.

   
__________________
RJ Emery, Eastern USA
WordPerfect 8 User on XP Pro SP3 System
OCR ScanSoft PaperPort SE v9 on
Brother MFC-8840DN Printer/Scanner/Fax
RJ Emery is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to center a graphic and text jwoolf09 Web Site Building & Maintenance 25 02-27-2007 12:50 PM
Bryce 6 (and the Vue product line) Andrew B. Software 1 11-14-2006 06:48 AM
First line and letter formatting Bo Aakerstrom Web Site Building & Maintenance 8 08-24-2006 07:45 AM
New HP A1510N Media Center Computer dthomsen8 The Corner Pub 20 08-20-2006 07:41 AM


All times are GMT -8. The time now is 03:01 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Contents copyright 2004–2014 Desktop Publishing Forum and its members.