What am i doing wrong?
Hi.
Trying to learn XHTML. Thought I could get it down in one day, hahahahah!!!
Can someone please look at this and tell me where I went wrong? If it helps to
know this, I am using w3schools.com to learn.
This is my coding:
XHTML TEST
< /p>
Testing< /b>
< /br>
How bad does my XHTML suck?
< /p>
< /td>
< /tr>
First try ever. < /br>
No clue what I am doing.< /br>
< /td>
If i do okay< /p>
CSS is next...< /br>
< /td>
< /tr>
And this is what my browser is showing:
< /p> {this is outside of table}
Testing< /b> < /br> How bad does my XHTML suck? < /p> < /td> < /tr>
First try ever. < /br> No clue what I am doing.< /br> < /td> If i do okay< /p> CSS is next...< /br> < /td> < /tr> {all this is inside the table}
Any and all help is much appreciated.
Shannon Whitehead
dk01 posted this at 07:22 — 1st April 2006.
He has: 516 posts
Joined: Mar 2002
Hi,
I went through your code and added the appropriate CSS and fixed some html errors you had. First thing you need to change is your DOCTYPE declaration. You should be using the global doctype in my example below and not a local copy.
Another thing I noticed was you had some invalid tags. In XHTML formatting is separate from data. This means that there is no tag, tag, or tag. Also is written:
Remember to use the XHTML validator here to check your documents for valid code. This will tell you where you have errors and will help you debug your code.
Here is the code I would use. Post here if there are any parts that you need explanations for. I am more than willing to go into detail on certain parts of the code.
Best of luck in your efforts to learn xhtml/css.
- Jim
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>XHTML TEST</title>
<style type="text/css">
/* This CSS changes the body background and alignment */
body {
background: #f7f7f7;
text-align: center;
}
/* This changes the link color */
a {
color: #ff4040;
}
/* This changes the visited link color */
a:visited {
color: black;
}
/* This is the CSS for the table. */
#centeredTable {
width:44%;
background:#ffffff;
margin: 0 auto;
text-align:left;
}
/* This is for the first row of the table */
.firstRow {
font-family: Arial, sans-serif;
font-size: medium;
color: #000;
width: 100%;
}
/* The CSS for the left hand column */
.columnLeft {
font-family: Verdana, sans-serif;
font-size: larger;
color: #191970;
width: 50%;
}
/* The CSS for the right hand column */
.columnRight {
font-family: Verdana, sans-serif;
font-size: larger;
color: #191970;
width: 50%;
}
</style>
</head>
<body>
<table id="centeredTable">
<tr>
<td class="topRow" colspan="2">
<p>
<strong>Testing</strong>
How bad does my XHTML suck?
</p>
</td>
</tr>
<tr>
<td class="columnLeft">
<p>
First try ever. <br />
No clue what I am doing.<br />
</p>
</td>
<td class="columnRight">
<p>
If i do okay<br />
CSS is next...<br />
</p>
</td>
</tr>
</table>
</body>
</html>
GDVS posted this at 12:19 — 1st April 2006.
They have: 36 posts
Joined: Mar 2006
Not quite true, the doctype for this document is XHTML 1.0 Transitional which allows both and tags while all XHTML DTDs permit . and were deprecated in HTML 4 but only obsoleted with XHTML 1.0 Strict. XHTML 1.0 Transitional no more seperates content from presentation than does HTML 4, in both cases it's down to the author to design the site well and avoid use of deprecated tags. CSS is the key to good clean design, not XHTML.
dk01 posted this at 19:29 — 1st April 2006.
He has: 516 posts
Joined: Mar 2002
Woops my mistake. Wrote that late last night. Well anyhow its always been my personal opinion that the more you can separate the design and content the better. Although you wouldn't be wrong to leave in your b, font, and center tags, it might just be easier to eliminate them now if you intend to start using CSS anyhow.
GDVS posted this at 19:50 — 1st April 2006.
They have: 36 posts
Joined: Mar 2006
You won't hear any arguments from me on that score . Just because the elements are allowed doesn't mean they should be used.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.