ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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".)
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.
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
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.