XHTML halp

Whyusosrs?

Veteran
Joined
Jul 7, 2010
Messages
494
I'm taking web design and we were practicing making websites today and for some reason, I could not get mine to work like I wanted it to.

Code:
<html>
<head>
<title>website</title>
</head>
<body bgcolor="#008080" text="#000000" link="#00FFFF" vlink="#9933FF">
<p>(text)</p><br />
<p><img src="superawesomesmiley.jpg" width="150" height="150" border="0" alt="super awesome smiley" /></p>
<hr size="4" />
<p>(more text)</p><br />
<p><img src="pacman.jpg" width="150" height="150" border="0" alt="pac man" /> </p>
<a href="website.html"> another site with more stuff </a>
</body>
</html>

Now, the problem was that the text of the page, the last few lines were on the same line as the picture. Like the text was on the side of the picture instead of the text being above the image like I wanted it to be. I couldn't fix it and neither could 2 college students there to help us. So, I don't know. Anyone have any thoughts? If not, I'll just have another crack at it tomorrow.

inb4lrnPHP
 
Huh... That's very weird. Whenever I was doing it it was more like

(last few lines of text)
awesome_smiley_photo_sculpture_photosculpture-p153359710604909267qdjh_400_151.jpg



Where the last lines were right beside the image rather then being on top like this.

(last few lines of text)
awesome_smiley_photo_sculpture_photosculpture-p153359710604909267qdjh_400_151.jpg



EDIT: We are just entering all code into notepad then saving as .html file. So I think there might have been a problem whenever I was trying to fix it it wouldn't save it properly and thus the .html never got updated. Not sure though.
 
Last edited:
lol at your "lrn2PHP".. as if that has anything to do with this XHTML >_>

No "2" in there just lrnPHP. Meant it more as a "don't tell me to go learn PHP because it's better then HTML" sorta thing.

EDIT: Also, I'm still fairly new at coding, so what function does <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> have in a webpage? Does it just specify what rules the webpage is following by? Like this doctype is strict so it can't do certain features whereas transitional can do almost all HTML attibutes and elements?
 
Last edited:
@srs, I don't think your understanding the difference between client-side and server-side technologies. PHP can't be compared to XHTML/HTML because it has a different purpose.
 
@Cride, I don't know a whole lot about the difference except that HTML is a markup language while PHP is for scripting. PHP can use HTML. PHP won't output anything if your coding is wrong. Uh. PHP files are dyanmic while HTML are static. And, HTML is easy, PHP, not so much. So yea, I don't know a lot of the difference since I basically have only just started to get serious about web design. If I was to make an analogy I would say that HTML is the furniture,books,and classroom while PHP is the teacher. The teacher can interact with the students but he also needs the classroom to function properly. anyway, it was just a joke that I probably didn't understand and thus probably shouldn't have typed. My mistake.

anyway, what function does <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> have in a webpage? Does it just specify what rules the webpage is following by? Like this doctype is strict so it can't do certain features whereas transitional can do almost all HTML attibutes and elements?
 
Last edited:
@Cride, I don't know a whole lot about the difference except that HTML is a markup language while PHP is for scripting. PHP can use HTML. PHP won't output anything if your coding is wrong. Uh. PHP files are dyanmic while HTML are static. And, HTML is easy, PHP, not so much. So yea, I don't know a lot of the difference since I basically have only just started to get serious about web design. If I was to make an analogy I would say that HTML is the furniture,books,and classroom while PHP is the teacher. The teacher can interact with the students but he also needs the classroom to function properly. anyway, it was just a joke that I probably didn't understand and thus probably shouldn't have typed. My mistake.

anyway, what function does <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> have in a webpage? Does it just specify what rules the webpage is following by? Like this doctype is strict so it can't do certain features whereas transitional can do almost all HTML attibutes and elements?

Yeah, if you're doing XHTML, you probably want

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

This tells the browser what rules to follow. I don't use strict; it's too strict...and from the looks of it XHTML isn't catching on anyway. Everyone is drooling over HTML5.
 
All those style-related attributes (bgcolor, text, link, vlink, etc.) have been deprecated. It's fine when you're just learning the basics, but you'll definitely want to start learning CSS soon. This also applies to the <br/> tag.

Re: DOCTYPE, see http://en.wikipedia.org/wiki/Document_Type_Declaration and also the W3C specs. Copypasting the question makes you seem like an annoying noob.

About your analogy: PHP is a programming language and doesn't need HTML for anything. It's often used for web development but you can do all kinds of stuff with it (not that I'd recommend it - there are nicer langs out there).

and from the looks of it XHTML isn't catching on anyway. Everyone is drooling over HTML5.
There'll also be XHTML5 for those who prefer a stricter and cleaner syntax. http://www.w3.org/TR/html5/introduction.html#html-vs-xhtml
 
Last edited:
Back
Top