2012-09-11 33 views
1

我有一个复杂的图像切成许多切片。 你可以看到http://jsfiddle.net/yefQR/使用CSS和div或span创建一个扩大图像

<!--Force IE6 into quirks mode with this comment tag--> 
<!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" lang="en" xml:lang="en"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<title>Page Title</title> 
<style type="text/css"> 

body{ 
margin: 0; 
padding: 0; 
border: 0; 
overflow: hidden; 
height: 100%; 
max-height: 100%; 
} 

#framecontentTop, #framecontentBottom{ 
position: absolute; 
top: 0; 
left: 0; 
width: 100%; 
height: 130px; /*Height of top frame div*/ 
overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/ 
background-color: navy; 
color: white; 
} 

#framecontentBottom{ 
top: auto; 
bottom: 0; 
height: 110px; /*Height of bottom frame div*/ 
overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/ 
background-color: navy; 
color: white; 
} 

#maincontent{ 
position: fixed; 
top: 130px; /*Set top value to HeightOfTopFrameDiv*/ 
left: 0; 
right: 0; 
bottom: 110px; /*Set bottom value to HeightOfBottomFrameDiv*/ 
overflow: auto; 
background: #fff; 
} 

.innertube{ 
margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/ 
} 

* html body{ /*IE6 hack*/ 
padding: 130px 0 110px 0; /*Set value to (HeightOfTopFrameDiv 0  HeightOfBottomFrameDiv  0)*/ 
} 

* html #maincontent{ /*IE6 hack*/ 
height: 100%; 
width: 100%; 
} 

</style> 



</head> 

<body> 

<div id="framecontentTop"> 
<div class="innertube"> 

<div id="screenshot%20tsam%20900r2c2" style=" background-color:  green;position:absolute; left:4px; top:6px; width:20px; height:68px; z-index:1; visibility:visible; "> 
</div> 
<div id="screenshot%20tsam%20900r2c3" style="background-color: yellow;  position:absolute; left:24px; top:6px;width:47px; height:68px;z-index:2; visibility:visible;"></div> 
<div id="screenshot%20tsam%20900r2c4" style="background-color: red; position:absolute;  left:71px; top:6px;width:165px; height:68px;z-index:3; visibility:visible;"></div> 
<div id="screenshot%20tsam%20900r2c5" style="background-color: black; position:absolute; left:236px; top:6px;width:62px; height:68px;z-index:4; visibility:visible;"></div> 
<div id="screenshot%20tsam%20900r2c6" style="background-color: pink; position:absolute; left:298px; top:6px;width:147px; height:68px;z-index:5; visibility:visible;"></div> 
<div id="screenshot%20tsam%20900r2c7" style="background-color: orange; position:absolute; left:445px; top:6px;width:311px; height:37px;z-index:6; visibility:visible;"></div> 
<div id="screenshot%20tsam%20900r2c9" style="background-color: cyan; position:absolute; left:756px; top:6px;width:108px; height:37px;z-index:7; visibility:visible;"></div> 
<div id="screenshot%20tsam%20900r2c11" style="background-color: white; position:absolute; left:864px; top:6px;width:27px; height:37px;z-index:8; visibility:visible;"></div> 
<div id="screenshot%20tsam%20900r3c7" style="background-color: DodgerBlue; position:absolute; left:445px; top:43px;width:8px; height:31px;z-index:9; visibility:visible;"></div> 
<div id="screenshot%20tsam%20900r3c8" style="background-color: Gold; position:absolute; left:453px; top:43px;width:355px; height:31px;z-index:10; visibility:visible;"></div> 
<div id="screenshot%20tsam%20900r3c10" style="background-color: LightCyan ; position:absolute; left:808px; top:43px;width:83px; height:31px;z-index:11; visibility:visible;"></div> 


</div> 
</div> 

<div id="framecontentBottom"> 
<div class="innertube"> 

<h3>Sample text here</h3> 

</div> 
</div> 


<div id="maincontent"> 
<div class="innertube"> 

<h1>Lorem</h1> 
<p> 

Lorem ipsum 

</p> 
<p style="text-align: center">Vestibulum </p> 

</div> 
</div> 


</body> 
</html> 

Id喜欢做:

1)标题图片使用宝蓝颜色和橙色div的重复-Y CSS属性autoexpanding因为你是像axpandible的只有2部分。 2)是否可以定义头部的最小尺寸,并且可以根据该尺寸使整个身体的最小尺寸成为可能,因此如果窗口变小,滚动条被显示,则浏览器不能变小。

回答

0

是的,只需在您的CSS中使用min-width即可。如果您需要,也可以定义max-width