LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-01-2013, 12:13 PM   #1
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Rep: Reputation: 29
HTML code not centering


What is it about the 1st line that WILL NOT center but the second will?
Code:
<html><head></head><body>
<p align="center"><h1>Lydia Ann Fly Masters</h1></p>
<p align="center"><b>Supporting Casting for Recovery</b></p>
<p><i>A note from Lydia Ann Fly Masters, Casting for Recovery and Alamo Fly Fishers.</i><<p/>
<p>Dear Friends and Anglers:</p>
</body></html>
Chrome, Opera, Foxfire, and Evolution all show the same.

I'm stumped.
view the whole web page here. http://texasflyfishers.org

Thanks for any insight offered.
Dave
 
Old 07-01-2013, 12:41 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by Dafydd View Post
What is it about the 1st line that WILL NOT center but the second will?
Code:
<html>
<head></head>
<body>
<p align="center"><h1>Lydia Ann Fly Masters</h1></p>
<p align="center"><b>Supporting Casting for Recovery</b></p>
<p><i>A note from Lydia Ann Fly Masters, Casting for Recovery and Alamo Fly Fishers.</i><<p/>
<p>Dear Friends and Anglers:</p>
</body>
</html>
[line breaks added to the code for clarity]
the answer is simple: This is invalid HTML. A paragraph (p element) must not contain another block level element. Nesting an h1 element inside p isn't allowed. So when the browser encounters the opening <h1> tag, it decides internally that the paragraph must end before that. That leaves an orphaned closing </p> at the end of the line, which is simply ignored.

Solution: Don't use a p element for that line. A headline is not supposed to be packaged into a paragraph.

And don't forget the title element inside the head - it's required by the spec.

By the way: You seem to have missed the evolution of web authoring over the last ten or more years. Controlling visual aspects with HTML attributes, or using HTML elements only for visual purposes is deprecated since long. That's where the power of CSS should be used instead. (This is not a "must", but an urgent "should".)

[X] Doc CPU
 
2 members found this post helpful.
Old 07-01-2013, 04:32 PM   #3
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Original Poster
Rep: Reputation: 29
Quote:
Nesting an h1 element inside p isn't allowed.
Quote:
A headline is not supposed to be packaged into a paragraph.
I have trouble using the correct word to search for. When you mentioned "headline", things snapped and I went to the 'W3school' site, and it produced the below line of code that works.
Code:
<h1 align="center">Lydia Ann Fly Master</h1>
Quote:
By the way: You seem to have missed the evolution of web authoring over the last ten or more years.
I took over this website about 10 years ago when the maintainer got transferred. Have tried to give it away, but no one in the club wants it. They bitch if somethings wrong but would rather go fishing.

What I code is from books of that time perion.

Thanks for you support and knowledge.
Dave
 
Old 07-02-2013, 11:25 AM   #4
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

good to hear you got somewhere. :-)

Quote:
Originally Posted by Dafydd View Post
I took over this website about 10 years ago when the maintainer got transferred. Have tried to give it away, but no one in the club wants it. They bitch if somethings wrong but would rather go fishing.
I know that kind of thing. *sigh*
For me, it's not websites (though I do that, too, sometimes), but one or the other software project. Some of them from the bronze age. On the one hand, that's a fine thing, because if you're the only one around who's still able to program some old 8bit CPU in assembler, you're an important guy (and hopefully get paid appropriately, which I can't complain about). And to be honest, it's actually some kind of challenge, some sort of fun to get along with such archaic systems. On the other hand, you tend to moan something like "oh no, not again", when you see an ominous e-mail in your inbox ...
Yet I hope these old machines may still work and be used for some time ...

Quote:
Originally Posted by Dafydd View Post
What I code is from books of that time period.
That explains a lot. And I agree: It wouldn't make sense to transplant a sixteen year old accident victim's heart to an old guy of ninety.

By the way, I consider myself more or less fluent in English (I've been mistaken for an American on several occasions), but I didn't know yet that "angling" (as a verb) is the same as "fishing". I knew the word "angle" as a term in geometry, but wasn't aware of another meaning, even though it's almost the same as the German verb "angeln" (infinitive).

[X] Doc CPU
 
Old 07-03-2013, 01:06 AM   #5
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Original Poster
Rep: Reputation: 29
Quote:
ETYMOLOGY: Middle English anglen, from angel, fishhook, from Old English."
Wasn't OE originally brought across the channel by the Germanic tribes as they invaded Britan, circa 13 century?
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML: post online/offline in html code? Xeratul Programming 3 08-11-2012 01:54 PM
HTML help, not centering User Name. Programming 6 12-17-2006 12:36 PM
html code and including html files Hockeyfan Programming 2 08-22-2005 05:11 PM
User Preferences: Use HTML code instead of vB code? (vB code is overrated) stefanlasiewski LQ Suggestions & Feedback 5 07-26-2005 01:37 AM
HTML code off pe2338 LQ Suggestions & Feedback 2 08-27-2003 02:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration