Jump to content

[SOLVED] Doctype forcing pictures on their original size


gli

Recommended Posts

Why, when i add  doctype  in my code, pictures are showing in their original size, not like i set at css ???

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

 

<html>
<head>
<link rel="stylesheet" rev="stylesheet" href="styles.css" />
<script type="text/javascript" src="skript.js"></script>
<style type="text/css">
<!--
#apDiv1 {
position:absolute;
left:205px;
top:16px;
width:200px;
height:100px;
z-index:1;
color: red;
}
-->
</style>
</head>
<body onLoad="goRightTime(), fadeOutTime()">
<div id="apDiv1"><a href='one.html'>this is one</a></div>
<a id="linkleft" href="#" onClick="goLeft(), stopInterval(), fadeout(), fadeout2()"></a>
<div id="boxLeft"><img id="imgLeft" src="images/0.gif" alt="imgleft"></img></div>
<div id="boxMid"><img id="imgMid" src="images/one.gif" alt="imgmid"></img></div>
<div id="boxRight"><img id="imgRight" src="images/two.gif" alt="imgright"></img></div>
<a id="linkright" href="#" onClick="goRight(), stopInterval()"></a>

</body>
</html>

you have not set the dimensions of any images in your css - indeed nor should you - you should use the width and height attributes within the mark up to do this....

 

I writed dimensions in <img> tag and img size is now working, but img border lost to, and position is now in other place.

Why doctype changes so much.

 

 

css:

img#imgleft {
width: 100px;
height: 80px;
border: 1px solid red;
}

img#imgright {
width: 100px;
height: 80px;
border: 1px solid red;
}

img#imgmid {
width: 200px;
height: 100px;  
border: 1px solid red;
margin-left: 4px;
margin-top: 5px;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.