我的进度是@http ://codebucket.webatu.com/code/portfoliotest/index.html
JSfiddle 上的代码:http: //jsfiddle.net/warmlaundry/qJbG4/70/
我想让'f'和'l'的边缘延伸到页面的边缘。我只是扩大了夹着这个词的两个图像的高度。
我希望这个词本身保持不变,我不希望扩展的图像取代任何其他元素。
有没有简单的方法来实现这一目标?我想这与正确定位有关,但我仍然没有完全掌握 CSS 定位的微妙之处。
如果这个问题是转帖,我深表歉意;如果不发布我自己的例子,我想不出一个很好的方式来表达这个问题。
编辑:这是我的代码(因为链接似乎很糟糕)
<html>
<head>
<style type="text/css">
#portfolioBottom{position:relative;top:-1px;}
#portfoliotop{position:relative;top:1px;}
</style>
<script type="text/javascript">
var heightBottom;
var heightTop;
var interval;
function addHeight(){
document.getElementById("portfolioBottom").style.width="249px";
heightBottom = parseInt(document.getElementById("portfolioBottom").style.height);
heightBottom=heightBottom + 5;
document.getElementById("portfolioBottom").style.height=heightBottom;
document.getElementById("portfolioTop").style.width="210px";
heightTop = parseInt(document.getElementById("portfolioTop").style.height);
heightTop=heightTop + 5;
document.getElementById("portfolioTop").style.height=heightTop;
}
</script>
</head>
<body>
<button onclick="interval=self.setInterval('addHeight()',1);">Start</button><button onclick="interval=window.clearInterval(interval)">Stop</button><br /><br />
<img src="http://codebucket.webatu.com/code/portfoliotest/portfolio top.png" id="portfolioTop" style="height:6px;" /><br />
<img src="http://codebucket.webatu.com/code/portfoliotest/portfolio.jpg" id="portfolio" /><br />
<img src="http://codebucket.webatu.com/code/portfoliotest/portfolio bottom.png" id="portfolioBottom" style="height:6px;" />
</body>
</html>