|
![]() |
#1 |
Member
Join Date: Mar 2005
Posts: 255
|
![]()
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 Vista System |
![]() |
![]() |
![]() |
#2 |
Staff
Join Date: Feb 2005
Location: In the Heart of the English Lake District
Posts: 1,381
|
![]()
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 |
![]() |
![]() |
![]() |
#3 | |
Member
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
|
![]() Quote:
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 ![]() Occasionally I am also connecting online dots... and sometimes you can follow me on Marjolein's Travel Blog |
|
![]() |
![]() |
![]() |
#4 |
Staff
Join Date: Feb 2005
Location: In the Heart of the English Lake District
Posts: 1,381
|
![]()
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 |
![]() |
![]() |
![]() |
#5 | ||
Member
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
|
![]() Quote:
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 ![]() 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:
__________________ Marjolein Katsma ![]() Occasionally I am also connecting online dots... and sometimes you can follow me on Marjolein's Travel Blog |
||
![]() |
![]() |
![]() |
#6 |
Member
Join Date: Aug 2005
Location: Arlington, VA (across the river from Washington, DC)
Posts: 560
|
![]()
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 |
![]() |
![]() |
![]() |
#7 |
Member
Join Date: Mar 2005
Posts: 255
|
![]()
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 Vista System |
![]() |
![]() |
![]() |
#8 |
Member
Join Date: Mar 2005
Posts: 255
|
![]()
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 Vista System |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trying to center a graphic and text | jwoolf09 | Web Site Building & Maintenance | 25 | 02-27-2007 01:50 PM |
Bryce 6 (and the Vue product line) | Andrew B. | Software | 1 | 11-14-2006 07: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 |