HTML question first page validated:)

i have been working on a simple website, its my first one:D. the page header is constructed of 5 images in a table. etch image has two versions, button in or out. the images will link to outher pages, and will be switched to show what page you are on.

everything is going well, except the images are loaded with a gap between them.

http://uploader.polorix.net//files/908/images/work%20in%20progress.jpg

the images are seamless, and should look like this

http://uploader.polorix.net//files/908/images/hedder.jpg

this is the relevant peace of code, i’m hand coding it

<center><table>

    <tr>
        <td><img src="image/home_out.jpg" width="355" height="120" alt="home_out.jpg" /></td>

        <td><img src="image/gallery_in.jpg" width="296" height="120" alt="gallery_in.jpg" /></td></td>

        <td><img src="image/aboutme_out.jpg" width="355" height="120" alt="aboutme_out.jpg" /></td></td>
    </tr>
</table>

<center><table>
    <tr>
        <td><img src="image/wip_in.jpg" width="355" height="100" alt="wip_in.jpg" /></td>

        <td><img src="image/complete_out.jpg" width="296" height="100" alt="gallery_in.jpg" /></td></td>
    </tr>

</table>

After height and width, add “border=0”, and maybe “cellspacing=0 cellpadding=0”, I don’t remember. Tables
are always made with a slight border, because otherwise text would collide. When you use images, the border jusr becomes a pain. But with this, it can be removed.

thank you, worked perfectly, with a little experimenting:).

Your td tags don’t seem paired up correctly… You’ve got 3 closing tags that don’t match any opening ones.

<td><img src=“image/gallery_in.jpg” width=“296” height=“120” alt=“gallery_in.jpg” /></td></td>

Have with fun your new website. :wink:

You should read up on separating style from content & semantic markup. For example this is not tabular data (so a table should not be used) and the images are presentational so they should be added via css. Also the center element was deprecated in html 4.01.

Probably the most impotent mistake is that the alt attributes should have alternate text not the image names, this text is going to be read by any thing that dose not support images (search engines, screen readers, text only browsers, etc).

Good luck with making your first website.

http://blenderartists.org/forum/clear.gif

                                                            Your td tags don't seem paired up correctly... You've got 3 closing tags that don't match any opening ones.

<td><img src=“image/gallery_in.jpg” width=“296” height=“120” alt=“gallery_in.jpg” /></td></td>

Have with fun your new website. :wink:

thankyou, fixed

You should read up on separating style from content & semantic markup. For example this is not tabular data (so a table should not be used) and the images are presentational so they should be added via css. Also the center element was deprecated in html 4.01.
cannot expect it to be perfect, just this morning i knew next to nothing about HTML. il have a look at css;). how can i center it without using <center>?

Probably the most impotent mistake is that the alt attributes should have alternate text not the image names, this text is going to be read by any thing that dose not support images (search engines, screen readers, text only browsers, etc)
thank you, i dident rilly know what thay did:o

the current state of the website can be seen here

i think its reasonably good considering that i knew nothing about HTML this morning:)
how can i get rid of the boxes around the links?

Since those images are links, here’s what you do HTML-wise:

&lt;div id="header"&gt;
&lt;a href="page1.html"&gt;&lt;img src="image1.jpg" alt="Description 1" /&gt;&lt;/a&gt;
&lt;a href="page2.html"&gt;&lt;img src="image2.jpg" alt="Description 2" /&gt;&lt;/a&gt;
&lt;a href="page3.html"&gt;&lt;img src="image3.jpg" alt="Description 3" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;a href="page4.html"&gt;&lt;img src="image4.jpg" alt="Description 4" /&gt;&lt;/a&gt;
&lt;a href="page5.html"&gt;&lt;img src="image5.jpg" alt="Description 5" /&gt;&lt;/a&gt;
&lt;/div&gt;

And, inside your <head> tags:

&lt;style type="text/css"&gt;
#header {text-align: center;}
#header * {padding: 0; margin: 0;}
&lt;/style&gt;

This will get what you want the standards compliant way, and is perfectly valid XHTML code.

Just don’t forget to change image1 and page1 etc. to the images and pages you want them to be.

Edit 1: By the way, the above will cause only that section of the page (the “header”) to be centered. If you want everything else centered, change the “#header {text-align: center;}” to “body {text-align: center;}” in the CSS.

Edit 2: Oh, and if you want to learn HTML the right and compliant way, go to www.htmldog.com. That will teach you the basics and the advanced stuff. Heck, I’ve read almost all of that site, and I STILL find stuff new in there.

Edit 3: Added the alt attribute to my code as N30N pointed out.

You should do something about all the spelling mistakes in the “about me” section. And the about me section also loads 2 headers.

I know your only trying to help but that markup is even worse than what hessiess came up with (you dont even have alt attributes). Just because it’s not using tables doesn’t make it any more correct, It’s a list of links so a ul element should be used.

Have a look at this blog post if you don’t understand what I mean.

Alright, so I forgot the alt attribute.

Actually, using a list will cause more confusion, and then you couldn’t make the bottom two appear correctly without having two lists. Also, if you use a list, it will be more confusing for him, because he has to add MORE CSS (#header * {display: inline;}) to it, and he might not know why he added it, so he might accidentally delete it, and not know why all his images are on a new line.

So, because he’s new, I still recommend the way I said above, though I admit he needs the alt attribute in the images.

Edit: Oh, and it isn’t really a list of links he’s using, its a line of images that happen to be links. So, making it a list would just make it more complicated and use more code than is necessary.

tynach:
i have tryed that code, it works exept im back were i started with the gaps.

when you click on a image in the wip page, it will link to a larger vertion. i am intending to use hd pings, and put a large image warning on the link. how can i make the image scail to the browser window width? so it will look the same on any monitor.

 &lt;html&gt;

&lt;head&gt;
&lt;title&gt;main&lt;/title&gt; 
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt; 
&lt;style type="text/css"&gt;
#text {text-align: center;}
#text * {padding: 0; margin: 0;}
&lt;/style&gt;
&lt;/head&gt;

&lt;body bgcolor="#ffffff"&gt;

&lt;div id="text"&gt;
&lt;h2&gt; image is full hd ping&lt;/h2&gt;
&lt;a href="main.html"&gt;&lt;h2&gt;back&lt;/h2&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;img src="image/full/hall_1.png" alt="large vertion of hall_1.jpg"&gt;

&lt;/body&gt;

&lt;/html&gt;

whats wrong with using tables to lay out a page?

Its harder to maintain code in a table layout. Also, it just isn’t the correct usage of tables.

Anyways, I expirimented with the solution I gave you, and found it was all a matter of idiotic thing which shouldn’t matter. You see, all the <img> and <a> tags need to be on the same line, all running into each other for it to work correctly. So, I’m looking into some better methods, as this would cause editing code to be a PAIN. Worse than tables.

Also, it seems the problem exists for lists as well. So, using N30N’s idea won’t solve the problem.

Edit 1: The cleanest code I can see for this is like what N30N suggested, with lists. But, the gaps still exist. But, here it is for you:

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
&lt;head&gt;
&lt;title&gt;The Website&lt;/title&gt;
&lt;style type="text/css"&gt;
* {text-align: center;}
#header * {padding: 0px; margin: 0px; border: 0px;}
#header img {height: 100px;}
#header ul {list-style: none;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="header"&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="page1.html"&gt;&lt;img src="image1.jpg" alt="Description 1" /&gt;&lt;/a&gt;
&lt;a href="page2.html"&gt;&lt;img src="image2.jpg" alt="Description 2" /&gt;&lt;/a&gt;
&lt;a href="page3.html"&gt;&lt;img src="image3.jpg" alt="Description 3" /&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="page4.html"&gt;&lt;img src="image4.jpg" alt="Description 4" /&gt;&lt;/a&gt;
&lt;a href="page5.html"&gt;&lt;img src="image5.jpg" alt="Description 5" /&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;

I would suggest not using links as images, but an image as the background, and put ordinary text for the link. A good thing to do is use tabs, like the ones found here.

Edit 2: Also, for what you wanted, with it looking the same on all screens, that would be elastic design. A good article is written here about it. And that’s the other thing good about not using tables. I used elastic design on my site, so no matter what device you view it on, it looks correct. It even works properly on my Nintendo DS.

It could be done by floating the li elements and use clear where he wants the line brake.

It’s good for him to start out doing things correctly rather than having to unlearn bad habits later on.

This is where your getting mixed up. The images are purely presentational (as is the fact that they are in a line), it’s not like a photo or something, they are not content.

Have a look at the blog post I liked to before.

To start with I dont recommend hessiess starts with xhtml (high probability it wound be invalid and served incorrectly). Now there is no division in the page and it doesn’t even help with styling so scrap the div and the markup for the lists is so bad it may as well be a table. It should be marked up like this.

&lt;ul id="navigation"&gt;
&lt;li&gt;&lt;a href="/"&gt;home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/gallery"&gt;gallery&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/wip"&gt;&lt;abbr title="work in progress"&gt;wip&lt;/abbr&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/complete"&gt;complete&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="/about"&gt;about me&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

Note I added the second list only because wip and complete are sub category’s and not just becaue is helps to style the page (thats just a added bonus of doing it correctly, which is often the case). Now there are many ways this could be styled to get hessiess’s desired result but I don’t have time to make the whole page for him.

PS. Tynach I hope you don’t feel like I’m picking on you and that you can see the importance of semantic markup.

I understand, but I’m just worried because I did try the various methods, and with the method you described, the only way to get them to appear one right after the other was to float them, and even that would work incorrectly, and also destroy the centering that he wants. And, it still has the spaces between the images.

Also, the division in his page is between the navigation and the content. I would personally use a layout like this:

&lt;div id="main"&gt;
&lt;div id="header"&gt;
heading and navigation
&lt;/div&gt;
&lt;div id="content"&gt;
Page Content
&lt;/div&gt;
&lt;div id="footer"&gt;
Copyright and footer info
&lt;/div&gt;
&lt;/div&gt;

would it work better with one image, and use image maps?

ive remade the home page using image maps. the image now also act’s as navigation.

 &lt;!DOCTYPE html PUBLIC "-//w3C//DTD XHTML 1.0 strict//EN" 
"http://www.w3.org/TR/xhtml/DVD/xhtml-strict.dtd"&gt; 
&lt;html&gt;


&lt;head&gt; 
    &lt;title&gt;home&lt;/title&gt; 
    &lt;style type="text/css"&gt; 
    body {text-align: center;} 
    &lt;/style&gt; 
&lt;/head&gt; 
 
&lt;body bgcolor="#574b9f" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"&gt; 
 
&lt;img src="image/home.jpg" alt="hedder image_home page" usemap="#hedder" border="0" /&gt;

&lt;img src="image/main.jpg" alt="home page" usemap="#homep" border="0" /&gt;

&lt;map name="homep" &gt;
&lt;area shape="rect" coords="21,141,346,336" href="gallery_wip.html"&gt;
&lt;area shape="polygon" coords="694,194,990,192,990,588,833,588,833,502,640,504" href="about_me.html"&gt;
&lt;/map&gt; 

&lt;map name="hedder"&gt;
&lt;area shape="rect" coords="0,0,339,100" href="main.html"&gt;
&lt;area shape="rect" coords="339,0,662,100" href="gallery_wip.html"&gt;
&lt;area shape="rect" coords="662,0,1000,100" href="about_me.html"&gt;
&lt;/map&gt;
 
&lt;/body&gt; &lt;/html&gt;

is this code valid?

I’ve never heared of it, but on HTMLdog, it doesn’t say anything about deprication or being invalid. So, I’d say yes, its valid.

Also, I think its ingeneous, so thanks for finding it.

It is kinda a personal preference I guess, it’s just that there’s wasn’t much point having the header div that only contains one element.

No, it could be done better with a object element using a child list for the maps but varies browsers have bad support for that (and I’m unsure how will it would work for screen readers). Also this is the old way of thinking where you style your page with html rather than with css.

No and just as importantly it’s not assessable. If you are going to listen to one thing I’ve said please use html unless you are going to research/learn how to implement xhtml correctly. For validating try the w3c validator.

If you don’t mind me asking where are you learning your (x)html from?

i have read the blog post, the first “bad” example makes a hell of a lot more sense to me than the second one dus. splitting up one page into multiple files just makes everything way more confusing for me.

No and just as importantly it’s not assessable. If you are going to listen to one thing I’ve said please use html unless you are going to research/learn how to implement xhtml correctly. For validating try the w3c validator.
i have been listening to everything you have sead, and i am resertching making valid code. it not beeing assessable was caused by a typo, which beeing dyslexic is a very conman problem. this reviled a number of other problems, mostly typo’s witch i have now corrected. the page now validates, except for one ‘potential issue’ with the character encoding. the page states
Specifying a character encoding is typically done by the web server configuration
it is currently hosted on unloader.polorix.net, which is a file host, not a web host. so thats probably the problem. although im probably completely wrong.
here is the link to prove that it validated

i am not using any particular scorce for learning (x)html. htmldog, w3schools and a large number of other websites found by searching. i am learning this in exactly the same way as i learnt blender, ubuntu and almost everything else i know how to do/use. I experiment until i get something that works. reserch errors and ask questions if i cannot find an anser

im going to stick to image maps until i find a better way to do it that actually looks how i want it to look. ie no gaps:)

how can i achieve the layout on the about me page, image on one side text on the other, aligned to the edges of the header. without using a table?
it curently dus not alighn with the header after replacing the <center> tag with the css. it centers the elements in the table, not the table on the page

ps, the home page renders perfectly on dads pda/ phone thingie:evilgrin:

Don’t use image maps. You don’t get to take advantage of browser caching that way. (You have a new map for every page instead of smaller buttons that can already be cached).

Believe it or not, the problem with the gaps is due to whitespace rendering issues. The newlines between your image tags is messing you up.

Try this:


&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
&lt;head&gt;
    &lt;title&gt;My image menu with no gaps&lt;/title&gt;
    &lt;style type="text/css"&gt;
        body {
            background-color: #fff;
        }
        #menuBar {
            text-align: center;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="menuBar"&gt;
    &lt;div id="menuBarTop"&gt;
        &lt;a href="#link1"&gt;&lt;img src="button.png" alt="my alt text" title="my title text" height="25" width="80" border="0" 
        /&gt;&lt;/a&gt;&lt;a href="#link2"&gt;&lt;img src="button.png" alt="my alt text" title="my title text" height="25" width="80" border="0" 
        /&gt;&lt;/a&gt;&lt;a href="#link3"&gt;&lt;img src="button.png" alt="my alt text" title="my title text" height="25" width="80" border="0" /&gt;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div id="menuBarBottom"&gt;
        &lt;a href="#link4"&gt;&lt;img src="button.png" alt="my alt text" title="my title text" height="25" width="80" border="0" 
        /&gt;&lt;/a&gt;&lt;a href="#link5"&gt;&lt;img src="button.png" alt="my alt text" title="my title text" height="25" width="80" border="0" /&gt;&lt;/a&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
    The whitespace between image tags can inject gaps into the display:
&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;

Notice how I split the image tag so that there is no space between any of the tags within the block. (You could do the same thing by putting them all on the same physical line of code). This is very important - this is where your gaps were coming in.

You’ll have to plug in your own image into the code, but there should be no gaps at all. It’s a silly bug, but it is what it is.

Nice fix, 86point5! I’ll have to remember that myself!

N30N, why don’t you recomend xhtml? All it is is normal HTML with a slash at the end of self-closing tags.

Edit: Tried it, and it gets rid of all the spaces except the one between the two rows. Code:

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
&lt;head&gt;
&lt;title&gt;The Website&lt;/title&gt;
&lt;style type="text/css"&gt;
* {text-align: center;}
#header * {padding: 0px; margin: 0px; border: 0px;}
#header img {height: 100px;}
#header ul {list-style: none;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="header"&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="page1.html"&gt;&lt;img src="image1.jpg" alt="Description 1"
 /&gt;&lt;/a&gt;&lt;a href="page2.html"&gt;&lt;img src="image2.jpg" alt="Description 2"
 /&gt;&lt;/a&gt;&lt;a href="page3.html"&gt;&lt;img src="image3.jpg" alt="Description 3" /&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="page4.html"&gt;&lt;img src="image4.jpg" alt="Description 4"
 /&gt;&lt;/a&gt;&lt;a href="page5.html"&gt;&lt;img src="image5.jpg" alt="Description 5" /&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;

Also, I suppose another difference with xhtml is that all the tags must (or should) be lower-case.