XHTML Validation including External Links (Target Blanks)

They have: 82 posts

Joined: Jun 2002

Hi

I'm designing my first site in XHTML and after submitting my almost completed page code to the W3C Markup Service for validation, it highlighted three things I'm puzzled with and would appreciate some guidance with please.

  • Are there no border attributes "0" used for images in XHTML? If not why?
  • I have a number of external links on the Site which I had intended to open up in another browser window (target blank). However XHTML does not seem to accept the attribute "target"? Any way around this please?
  • Lastly (& I realise this is more CSS-related), if I have 5 images sitting one above each other in a column-type format, is there any way of specifying vspace or equivalent to space them out vertically from each other? Currently I have the ID #linksright (see below) applied as follows.

#linksright {
float: right;
width: 100px;
margin: 0 5px 0 0;/
padding: 0px;
font-size: 0.9em;
line-height: 1.5em;
}

Relevant code looks like this




Many thanks
Andrew

dk01's picture

He has: 516 posts

Joined: Mar 2002

I think I can answer most of your questions.
1. No. There are still borders in xhtml. Its just that they are to be set in CSS and not in xhtml. Since most formatting is to be done now in xhtml in css, images are the same way. The easiest way to set img borders to 0 with css is to use the css statement:
img { border: medium none; } // be nice to old browsers and use medium none

2. This can be overcome using the method sitepoint uses. It is described in the following article (3 pages long Laughing out loud):
http://www.sitepoint.com/article/standards-compliant-world/1

3. To add vspace or hspace to images simply use margins in css. In your case it'd be something like this:

#linksright img {
margin-top: 20px;
}

This basically will add a margin to the top of every img inside linksright. If instead you want to add 10 on the top and 10 on the bottom then just do this:

#linksright img {
margin-top: 10px;
margin-bottom: 10px;
}

So that's pretty much it. Hope I could be of some help!

They have: 82 posts

Joined: Jun 2002

Thanks for the prompt and detailed answer dk01.
I'll give it a bash tomorrow.
Many thanks

Roo's picture

She has: 840 posts

Joined: Apr 1999

Srtict or transitional?

With XHTML Transitional you can indeed have border="0" in the image tag. However, one little boo-boo such as a missing quote mark or not closing the image tag properly, or not closing a div tag etc. will cause vaidation errors.

A missing quote mark with cause a whole page to throw a filt.

Also...don't know about strict, but with Trans you need to use target="blank" and not the old target="_blank"

Roo

dk01's picture

He has: 516 posts

Joined: Mar 2002

Yes I just assumed you were going to be using strict. If you are using transitional then disregard my post.

They have: 82 posts

Joined: Jun 2002

Are there online Validators for transitional XHTML and if so where please (I can't find any)?
Also what are the merits of one standard against the other?
Cheers

Roo's picture

She has: 840 posts

Joined: Apr 1999

It has nothing to do with specific validators...it's all in your doctype. Use the W3C validator, it will test according to the doctype you've used.

Roo

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.