Validate XHTML Strict 1.0 for an iframe..and other stories

You know, put aside the wasteful markup on the page, you’ve managed to come up with one of the few scenario’s where I’d say go ahead and use the iFrame if you aren’t going to have any sort of server side scripting involved… Which means make the page XHTML transitional.

Personally if it was one of my pages, I’d probably use php to read the page in remotely, strip off the stuff I didn’t need and data scrape it to present it to match the page better – but you have to ask if it’s worth all that extra code on the server for something so simple… in this case it’s probably not - so go ahead, deploy as transitional and use the iframe. (which is a difficult thing for me to ever say)

Mostly it’s the rest of the page I’d be worried about more than the iframe. You’ve got a LOT of div and classes in there that just don’t do anything… like #header (you’ve got a perfectly good h1), #sitebranding (you’ve got a perfectly good h1), #tagline (I’d probably make that a small tag inside the h1), #navigation (perfectly good UL), span in the footer (perfectly good DIV)… or that the footer list isn’t marked up as a list.

Still, very refreshing to see quite so clean a codebase, which means you at least got MOST of what Ian covers in his book… frankly if you’re just starting out and working from Ian Lloyd’s beginner book - you’re already head and shoulders above 90% of the people you see posting code on forums like this one… especially in terms of things like heading orders, paragraphs around paragraphs (though it being around some non-paragraph elements bothers me), etc, etc…

I mean, if I had coded your homepage, the only major changes would be inside HEAD – like removing the title abuse, cutting down keywords to actually contain keywords, cutting down the description meta so it does it’s job and isn’t redundant to title… and gutting your header.

something like this

<!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"
	lang="en"
	xml:lang="en"
><head>

<meta
	http-equiv="Content-Type"
	content="text/html; charset=utf-8"
/>

<meta
	http-equiv="Content-Language"
	content="en"
/>

<meta
	name="keywords"
	content="Frigiliana,holiday,rentals,villa,country,pool,Costa del Sol,Malaga,families,children,private, sea"
/>

<meta
	name="description"
	content="Holiday villa for rent in Frigiliana with private swimming pool, views of the sea and private parking."
/>

<link
	type="text/css"
	rel="stylesheet"
	href="screen.css"
	media="screen,projection,tv"
/>

<title>
	Frigiliana Holiday Rentals
</title>

</head><body>

<h1>
	Holiday Villa for Rent in Frigiliana<br />
	<small>Private swimming pool, sea views and within walking distance of Frigiliana.</small>
</h1>

<ul id="mainMenu">
	<li><a href="index.html">Home</a></li>
	<li><a href="about.html">About The Villa</a></li>
	<li><a href="gallery.html">Photo Gallery</a></li>
	<li><a href="availability.html">Availability and Prices</a></li>
	<li><a href="contact.html">Contact</a></li>
	<li><a href="http://www.frigilianaholidayrentals.blogspot.com">Blog</a></li>
</ul>
 
<div id="content">
	<h2>Welcome to our holiday villa in Frigiliana!</h2>
	<img
		src="gallery/gate_house_garden.jpg"
		class="feature"
		width="200" height="162"
		alt="The villa set on a hillside of wild rosemary, thyme and lavender."
	/>
	<p>
		Thanks for dropping by our holiday villa in Frigiliana! If you are looking for a holiday villa for rent in the Frigiliana countryside for spending a relaxing and enjoyable holiday, then you have definitely come to the right place! <a href="gallery.html">Just have a look at some of the pictures</a>!
	</p><p>
		Our villa is perfectly located within walking distance of Frigiliana. Frigiliana is a lively little village about 7 kilometres inland from Nerja which is a larger and better known town on the Mediterranean coast on the eastern Costa del Sol, Malaga, Spain.
	</p><p>
		Our 2 bedroom, 2 bathroom holiday villa is in the countryside but literally only a 5 minute walk to the village of Frigiliana on a level, surfaced country lane. As such, the villa is perfect for elderly people or families with children for its convenient location. It is fully south facing with large outdoor terraces and private swimming pool.
	</p><p>
		A car is not necessary as it is so easy to just walk into the village to meet up with friends for a drink or an evening meal in any one of the excellent restaurants, and then walk back home afterwards, even if you find yourself a little tipsy! No problem! <a href="about.html">Find out a little more about our holiday villa</a>.
	</p>
	<img
		src="gallery/terrace_house.jpg"
		class="feature"
		width="200" height="162"
		alt="View of the house and front terrace from the pool terrace."
	/>
	<p>
		Frigiliana is a special and unique village. It has won many awards for its efforts to maintin its historical and architectural heritage. The historical centre in the old town, and especially the "moorish quarter", still retains its original aspect and character.
	</p><p>
		There are so many outdoor activities available and things to see and do both in Frigiliana and Nerja. Nerja and the coast are just a 10 minute drive away! According to the travel information website TripAdvisor, Nerja has been highlighted as one of the Top Ten Beach Towns in Europe! Now how about that!
	</p><p>
		Things to do in Frigiliana include walking and trekking, horseback riding excursions into the foothills of the Sierra de Tejeda, Almijara y Alhama Natural Park and or participating in the local festivals and fairs, to name a few. Or experience the famous and undeniably spectacular "Cuevas de Nerja" or Nerja caves which is the most visited tourist attraction in Spain after the well known "Museo del Prado" or Prado Museum in Madrid and the Alhambra palace in Granada.
	</p><p>
		Frigiliana's climate and weather is wonderful as the summers are relatively cool and the winters are much less severe than in northern climes.
	</p><p>
		<a href="availability.html">Have a look at our prices and availability</a>. Our prices are extremely competitive. And that ain't no lie or simple small talk!
	</p><p>
		Feel free to <a href="contact.html">contact us</a>.
	</p>
<!-- #bodyContainer --></div>

<div class="footer">
	<ul>
		<li><a href="index.html">Home</a></li>
		<li><a href="about.html">About The Villa</a></li>
		<li><a href="gallery.html">Photo Gallery</a></li>
		<li><a href="availability.html">Availability and Prices</a></li>
		<li class="last"><a href="contact.html">Contact</a></li>
	</ul>
<!-- #footer --></div>

</body></html>

Is all you should need given your appearance. You can see I pretty much swung a giant axe at all those DIV you had at the start as being pointless.

Oh, and take notice of the commenting style - putting the comment before the close let’s you know it’s being closed, while not tripping the IE rendering bugs putting it after would. Had you been doing that you may not have forgotten to close #bodyContent in the appropriate place… wait, re-reading before hitting post… that’s intentional? Given the indenting across the page you may have been better off actually indenting all that for clarity then… that or just pad one side equal to the sidebar so that the ‘structure’ makes more sense.

Still, not bad… for a human… — better than most of the garbage I’m used to seeing from ‘experts’ in the field.

How odd. That’s the first time I noticed that that while iframe requires a loose DTD, it is not (officially) deprecated. What you’d call it is beyond me, since it can’t be used with the current recommendation. Of all listed elements, it’s the single exception to the apparent rule that elements with a loose DTD requirement are deprecated.

:shrug:

gary

Yeah, don’t use an iFrame.

No joke - frames have no place in STRICT and will NEVER be valid. You want frames, you need to use the much more permissive “transitional” or the doctype MEANT for doing frames - FRAMESET.

From the errors you mentioned, and your using a iframe in the first place, probably means that IMHO you are going about constructing the site all wrong… since iFrames have LONG since been abandoned as an accessibility /FAIL/ and the other errors sound like either unclosed tags in a XHTML doctype… basically a mix of outdated techniques/methodologies with outdated markup.

But I’d have to see the actual code to be more specific. You don’t show us the actual page, we can’t help you apart from wild guesses in the dark.

Wow! Thanks for the quick reply! Ok, deathshadow60, here’s the html for the meta description tag and the iframe. felgall, i’m not sure if converting to HTML 4 is a good idea. i mean, i have no clue whether it is or isn’t. i’ll follow the link you sent me, thanks, and i’ll let you know how i get on:

<!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>
     <title>Frigiliana Holiday Rentals - availability and prices of holiday villa for rent 2010 - 2011.</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
         <link href="style1.css" rel="stylesheet" type="text/css" />
         <meta name="title" content="Frigiliana Holiday Rentals - availability and prices of holiday villa for rent 2010 - 2011." />
         <meta name="keywords" content="Frigiliana Holiday Rentals,holiday villa for rent in Frigiliana,villa availability,prices and availability,Frigiliana village,bookings for smaller groups,special price for couples,accommodation,long term bookings,winter lets,villa reservations,airport transfer,airport pick-up, />
         <meta name="description" content="Frigiliana Holiday Rentals welcomes you to view availability and prices for holiday villa for rent." />
  </head>
  <body>
    <div id="header">
      <div id="sitebranding">
         <h1>Holiday Villa for Rent in Frigiliana</h1>
      </div>
      <div id="tagline">
         <p>Fabulous holiday villa with pool for holiday rent - within walking distance of Frigiliana.</p>
      </div>
    </div> <!-- end of header div -->
    <div id="navigation">
         <ul>
            <li><a href="index.html">Home</a></li>
            <li><a href="about.html">About The Villa</a></li>
            <li><a href="gallery.html">Photo Gallery</a></li>
            <li><a href="availability.html">Availability and Prices</a></li>
            <li><a href="contact.html">Contact</a></li>
            <li><a href="http://www.frigilianaholidayrentals.blogspot.com">Blog</a></li>
         </ul>
      </div> <!-- end of navigation div -->  
    <div id ="bodycontent">
         <h2>Villa Availability, Prices, Terms and Conditions</h2>
         <p>Our prices are extremely competitive and represent excellent value for money when one considers one of the big advantages of renting this villa is that it is within 500 metres of Frigiliana village (5 - 8 minute walk) on a level and surfaced road.</p>       
         <div>
         <iframe src="http://www.holidaylettings.co.uk/avail_white.asp?home_id=97484" width="650" height="600" scrolling="no" frame-border="0" margin-height="0" margin-width="0"></iframe>
         </div>
<h3>Prices</h3>
         <p>Prices are quoted for bookings of 1 week. The minimum booking is 1 week. Discounts are available for bookings of 4 weeks or more.</p>
         <table class="prices" summary="Prices for 2010 - 2011.">
         <caption>Prices for 2010 - 2011</caption>

Which is why I kneejerk into the “what the hell is this crap” mode the moment I see an IE conditional comment, multiple javascripts, and bloated hackery just so you can use “the old way and the new way at the same time” - in other words, making twice as much work for yourself instead of going to the techniques that works everywhere with just one simple tag.

Even my rabidly anti-transitional self would probably use the iframe with a tranny doctype there rather than get myself knee deep into the semi-broken object with all sorts of skullduggery to try and make it work.

… and remember, while IE6’s total market share has gone down, the number of people using it has in fact been steady since the post-IE8 stabilization. Not surprising since it’s the most common and recent version of IE on mobile, and the most recent version available to 2k/9x… which there are a hell of a lot of people still using.

It’s easy to go “Oh, it’s down to 20% of the market and falling”, but not when the market is growing by leaps and bounds into developing nations while plateaued in developed ones; so basically that 294 million users really isn’t going anywhere.

Again, don’t let market share be used to lie to you. Illegal OS like “tomato XP” or “tinyXP” have done more for firefox promotion in the third world and developing nations than commercial sales in the civilized world. Oh noes, IE (all versions combined) dropped from 92% to 54% from 2005 to date - that means there’s less IE users, right?

WRONG - there are in fact MORE IE users than ever!!! Simple math - in 2005 there was just over 1 billion internet users, today the number is figured around 2.1 billion. Last time I checked, 92% of 1 billion is 920 million… 54% of 2.1 billion is 1.134 billion… meaning that while going from 92% market share to 54% market share, IE has GAINED 214 million users. You chart it out, their number of users has seen steady growth at about the same rate since 2001… it’s just the market has grown faster than their rate of growth!

The lie of percentages, you change the size of the pool, ‘losing’ share can be meaningless or used to sell the exact opposite of what is REALLY happening. This is especially true if so called ‘competitors’ are expanding into markets you aren’t going after in the first place - like places where people don’t have money.

You know, the same market where you might find people shlepping along old P2’s or P3’s running 98, ME or 2K because they can’t afford to blow a months rent on a new computer?

If you want to see it live, here’s the link:

I had only cut out some of the unimportant html, like <p>, to keep it compact for the forum.

BTW, I built the site using Ian Lloyd’s book “BYOWTRW…” so I know the html is generally ok, apart from the bits where I added and subtracted bits and pieces of other stuff where I might have forgotten to close a tag properly.

The original question about the iframes was due to the fact that I decided to incorporate an availability calendar from another website that was offering it.

That comment made by felgall on converting to HTML 4 could be of interest if it means I would be able to keep my availability calendar by converting only that page with the calendar to HTML 4 Strict to get around the iframes issue.

I don’t see a closing tag for <div id=“bodycontent”>.

Thanks for the help gary.turner. I’ve already changed it and the page now checks out as validated. However, putting the missing div tag in:

       <div class="footer">
           <span class="footer"><a href="index.html">Home</a> | <a href="about.html">About The Villa</a> | <a href="gallery.html">Photo Gallery</a> | <a href="availability.html">Availability and Prices</a> | <a href="contact.html">Contact</a></span></div>[COLOR="Red"]</div>[/COLOR]

…causes my footer to rest right smack on the bottom of the page. I previously had a couple of <br/> tags in there to space it away from the very bottom of the page (looks better) but the validator is telling me that the <br/> elements aren’t accepted in HTML 1.0 Strict. Is there an alternative valid element I can use?

That site has nothing to do with the standards. The standards can be found at w3c.org

The HTML 4 strict doctype defines what is valid in HTML 4. The transitional doctype is for use by those still transitioning to HTML 4 from earlier versions of HTML.

iframe was deprecated in HTML 4 meaning that as from when HTML 4 was released for use in 1999 the ifram tag was no longer supposed to be used. Unfortunately the HTML 4 tag that you are supposed to use doesn’t quite work properly in Internet Explorer. That iframe is listed as deprecated in HTML 4 specifically means that it is NOT a part of that standard. Deprecated is a term that means that the tag is something that you should specifically avoid using as it is considered to be the wrong way of doing it according to the standard

w3schools is a web site created by two people with no connection whatever with any standards and is NOT an authority on standards - they get lots of things wrong - they are no more an authority on standards than any other web site created by an individual is

copy and paste of a INCOMPLETE snippet still leaves us guessing - through right now I’d say what you’re displaying in the iframe should be pulled and displayed server side by whatever page you are using to show it, and not combined client side…

Well, that and the div around the h1 that’s probably for nothing, the paragraph around what should PROBABLY be a small tag inside the h1 (though I’d have to see the ENTIRE page as something that RENDERS to say for sure), header div that serves no purpose, div around the menu for no reason… Not entirely sure on the heading orders though it LOOKS ok on that count…

Though it’s refreshing to see someone actually bothering to use CAPTION on a table…

But really, do you have a copy of the page in question live so we can see what it’s supposed to look like, the FULL html, and the FULL CSS? Otherwise we’re still making wild guesses in the dark.

Though really, I’d rewrite it so you aren’t using frames or loading remote data client side in the first place.

I don’t see a closing tag for <div id=“bodycontent”>.

Line 31, Column 7: start tag was here
<div id="bodycontent">

And there’s the error message.

cheers,

gary

If you’re using iframes, you can’t use a Strict doctype, you have to use Transitional.

Second, there is no hyphen in frameborder or marginheight.

Yup, it’s absolutely fine to have some pages using Strict and some using Transitional. It isn’t ideal, because it creates a bit more work for you making sure everything is right, but it’s no big deal really - I’ve done the same thing, had a site that was almost entirely in Strict, but one section that needed to use iframes so those pages are in Transitional.

The problem is with the HTML - there’s no way to fix it with CSS!

It’s disappointingly simple - you’ve forgotten the closing " on the meta keywords tag, so it is taking the first " on the description line as the end of the keywords tag, and then getting confused because it’s got a load of gobbledegook it doesn’t know what to do with. (If you look at the code sample you’ve posted, you can see the final meta is in a different shade of blue to the others).

Er … what? HTML 4 definitely does include <iframe>, see http://www.w3schools.com/tags/tag_iframe.asp. I’ve been using iframes in HTML4.01 for quite some time, and it works just as well in IE6 as in other browsers.

If you have to use Ajax to achieve the same effect then it does not provide exactly the same functionality.

I have this kind of setup:

<iframe src="default.htm" name="inset">Alternative text</iframe>
<ul><li><a href="option1.htm" target="inset">First option</a></li>
    <li><a href="option2.htm" target="inset">Second option</a></li>
    <li><a href="option3.htm" target="inset">Third option</a></li>
</ul>

and it works. To replicate that without the iframe would require Javascript, which makes it a more cumbersome and less accessible solution.