...

View Full Version : Centre table



Pappu
06-18-2012, 09:46 PM
Hi, im making a website for college as part of my assignment. Im using adobe dreamweaver. So i inserted a table and right click and allign centre, then insert image inside the table and save the page, when i validate it, it shows this error.


Line 10, Column 12: there is no attribute "align"

<div align="center">

This is the page


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div align="center">
<table width="1000" border="0">
<tr>
<th scope="col"><img src="images/logo.jpg" alt="" width="1000" height="250" /></th>
</tr>
</table>
</div>
<div align="center">
<table width="1000" border="0">
<tr>
<th scope="col"><img src="images/car logos.png" alt="" width="1000" height="75" /></th>
</tr>
</table>
</div>
<p>&nbsp;</p>
</body>
</html>

dan-dan
06-18-2012, 10:13 PM
Asking help online for a college assignment? I think someome's being naughty tut tut.

felgall
06-18-2012, 10:22 PM
The align attribute was part of HTML 3.2 - that was replaced in 1997 wsith HTML 4 and CSS.

Aligning something is part of its appearance and so should be done with CSS which is why there hasn't been an HTML command to do it since 1997.

You can align blocks in the centre by giving them a width and auto margins in the CSS.
You can align text using text-align

dan-dan
06-19-2012, 07:41 PM
iBall, when I went to school not even three decades ago you kinda had to do your own homework and assignments weirdly enough, and I'm pretty sure things haven't changed that much since.

I understand reading your text books. I understand asking your teacher for assistance. I understand researching on the internet or in a library. But to go on to a coding forum and ask coders what's wrong with your code? I think if there's a line, that might just be crossing it lol.

Even if someone does go to one of these schools which believe in these alternative educations, I'm STILL not going to do their homework/assignments. Call me old fashioned, but I believe in justified gain.

felgall
06-20-2012, 03:01 AM
1. Your divs are redundant and unnecessary. Tables are block level elements and you can center them as you would any other block level element (see example below).

In this instance the table is actually the element that shouldn't be there - the required result can be obtained by wrapping the image inside a div.

Pappu
06-20-2012, 06:11 PM
Im not asking anyone to do my work. I have already completed my website and it looks fabulous, just the way i wanted it. But unfortunately it didnt pass the w3c validator, i had to make some changes which then kinda ruined my website. :(

dan-dan
06-20-2012, 06:38 PM
But asking someone for help on a particular issue on a website is no different to asking someone face to face or consulting a book.

It's very different from consulting a book. Consulting a book is called research! Reading books or e-type literature is a big part of study. Asking someone for the answer is exactly that, no explanation needed. Asking a teacher for help isn't even always an option, depending on the type of assignment.

Even helping with a specific issue, that isn't what you've done, now or previously with other members. Felgall gave an explaination of what's wrong, whereas you rewrote their code... their assignment!

Shocking that you can't see what's wrong there, it really is!



It's members actually doing the homework for others that is frowned upon my the mods., but it is not against the forum rules.

I've never once said it was against the forum rules, so I'm baffled as to why you've said that again. All I've spoken of is my distaste. And all because something isn't against the rules doesn't mean it's right.


No-one in this thread has done the homework for the op and the posted information can easily be found in books, other websites and by asking other web developers face to face.

All because you haven't completed their assignment from start to finish doesn't mean you haven't done it in part. As already mentioned, you rewrote part of their code which they may not have had the skill to do for themselves.

And that is exactly what should have been done: Researched the error in a book or on the internet. Taken some initiative and found out the problem for themselves.

Anyways, I'm done here. So I'll continue to believe students should do their own work while you continue to do it for them.

waxdoc
06-21-2012, 01:21 AM
It puzzles me why hunks, who think libraries like jQuery (that do half the work for you) are great, hammer down on a tool like Dreamweaver.

You have to start somewhere. I see professors of introductory Web site development courses using <TABLE>s for starters. After you get the basics of HTML mark-up structure under your belt, you move on to the complexities and possibilities of CSS for appearance.

For a nifty Dreamweaver time-saving and typo-avoiding assist, hit the space-bar inside opening tag to get drop-down list of possible attributes -- such as align -- click attribute for next drop-down of possible values. Or use CSS margin-right: auto and margin-left: auto to center block-level elements.



<table align="center" width="200" border="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

felgall
06-21-2012, 03:10 AM
There's nothing wrong with using DreamWeaver as long as you work mainly in code view. I know of lots of professionals who use it who never use the WHSIWYAG interface.

There's also nothing wrong with using jQuery as long as you have sufficient understanding of JavaScript to know what parts of your script should use it and what parts should not. If you could write the script without using jQuery then you know enogh JavaScript to use jQuery properly.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum