L
Larry Lindstrom
Hi Folks:
Learning HTML with current Firefox running on XP Pro, served by
current Apache running on current OpenSolaris.
I wrote some CGI and Javascript, in C++ for Solaris in the last
century, and haven't done anything with it since. So I'm a newbie
working through w3schools html stuff.
I've decided to try for the XHTML standard, I don't have a big
toolbox full of HTML code that I written, and need to bring into new
projects.
I'm starting all of my XHTML with:
----------
<!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>
Whatever....:
</title>
</head>
----------
Of course, the head section has other things individual examples
use, like styles
I've started using XHTML with the CSS tutorials after finishing the
HTML Basic and Advanced part of the course.
It's been going well, and when things don't work I can use W3C's
validate to find a problem, and the validation comes up clean on
debugged XHTML.
But I've come upon w3schools CSS dimension tutorial, and I'm
stumped.
I'll use the second dimension example, because that's short. It's
at:
http://www.w3schools.com/css/tryit.asp?filename=trycss_dim_height_percent
The code follows:
----------------
<html>
<head>
<style type="text/css">
img.normal {height:auto}
img.big {height:50%}
img.small {height:10%}
</style>
</head>
<body>
<img class="normal" src="logocss.gif" width="95" height="84" /><br />
<img class="big" src="logocss.gif" width="95" height="84" /><br />
<img class="small" src="logocss.gif" width="95" height="84" />
</body>
</html>
----------------
This example works as expected, using w3schools "Tryit Editor,
There are 3 logos displayed in the right pain, One is "normal" size,
one is half the height of the pain, and one looks like it's 10% of the
pain's height.
But the code I've built, under my XHTML DOCTYPE, shows all of the
images the same size.
If I copy my DOCTYPE clause, <html xmlns... , and meta element into
the source at the Tryit Editor, this causes the images all show at the
same size. So defining this as XHTML instead of HTML seems to be
enough to break it.
I copy the modified HTML from my Windows PC to www/.../htdocs on my
Solaris PC running Apache, change the image src to an image on that
machine, add "alt" to the img elements and try it.
The 3 images are the same size.
The page validates. Here it is.
-----------------
<!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>
CSS Dimension Problem
</title>
<style type="text/css">
img.normal {height:auto}
img.big {height:50%}
img.small {height:10%}
</style>
</head>
<body>
<div>
<img class="normal" src="../../images/002.jpg" width="95" height="84"
alt="Yikes" /><br />
<img class="big" src="../../images/002.jpg" width="95" height="84"
alt="Yikes" /><br />
<img class="small" src="../../images/002.jpg" width="95" height="84"
alt="Yikes" />
</div>
</body>
</html>
-----------------
What am I doing wrong?
Thanks
Larry
Learning HTML with current Firefox running on XP Pro, served by
current Apache running on current OpenSolaris.
I wrote some CGI and Javascript, in C++ for Solaris in the last
century, and haven't done anything with it since. So I'm a newbie
working through w3schools html stuff.
I've decided to try for the XHTML standard, I don't have a big
toolbox full of HTML code that I written, and need to bring into new
projects.
I'm starting all of my XHTML with:
----------
<!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>
Whatever....:
</title>
</head>
----------
Of course, the head section has other things individual examples
use, like styles
I've started using XHTML with the CSS tutorials after finishing the
HTML Basic and Advanced part of the course.
It's been going well, and when things don't work I can use W3C's
validate to find a problem, and the validation comes up clean on
debugged XHTML.
But I've come upon w3schools CSS dimension tutorial, and I'm
stumped.
I'll use the second dimension example, because that's short. It's
at:
http://www.w3schools.com/css/tryit.asp?filename=trycss_dim_height_percent
The code follows:
----------------
<html>
<head>
<style type="text/css">
img.normal {height:auto}
img.big {height:50%}
img.small {height:10%}
</style>
</head>
<body>
<img class="normal" src="logocss.gif" width="95" height="84" /><br />
<img class="big" src="logocss.gif" width="95" height="84" /><br />
<img class="small" src="logocss.gif" width="95" height="84" />
</body>
</html>
----------------
This example works as expected, using w3schools "Tryit Editor,
There are 3 logos displayed in the right pain, One is "normal" size,
one is half the height of the pain, and one looks like it's 10% of the
pain's height.
But the code I've built, under my XHTML DOCTYPE, shows all of the
images the same size.
If I copy my DOCTYPE clause, <html xmlns... , and meta element into
the source at the Tryit Editor, this causes the images all show at the
same size. So defining this as XHTML instead of HTML seems to be
enough to break it.
I copy the modified HTML from my Windows PC to www/.../htdocs on my
Solaris PC running Apache, change the image src to an image on that
machine, add "alt" to the img elements and try it.
The 3 images are the same size.
The page validates. Here it is.
-----------------
<!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>
CSS Dimension Problem
</title>
<style type="text/css">
img.normal {height:auto}
img.big {height:50%}
img.small {height:10%}
</style>
</head>
<body>
<div>
<img class="normal" src="../../images/002.jpg" width="95" height="84"
alt="Yikes" /><br />
<img class="big" src="../../images/002.jpg" width="95" height="84"
alt="Yikes" /><br />
<img class="small" src="../../images/002.jpg" width="95" height="84"
alt="Yikes" />
</div>
</body>
</html>
-----------------
What am I doing wrong?
Thanks
Larry