gpt4 book ai didi

html - Css 定位和照片大小调整

转载 作者:太空宇宙 更新时间:2023-11-04 05:12:00 25 4
gpt4 key购买 nike

我在定位和调整照片大小方面遇到了麻烦。这是图片:

enter image description here

1 block - 这是一张照片,应该始终可见(没有滚动条!),2 和 3 block 大小取决于窗口大小。我应该怎么做?

最佳答案

刚玩过。

试试这个。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script>
$(document).ready(function() {
$photoheight = $('.photo').css('width');
$('.photo').css('height', $photoheight);
$(window).resize(function(){
$photoheight = $('.photo').css('width');
$('.photo').css('height', $photoheight);

});
});
</script>
<style>
.photo {
min-width:200px;
width:25%;
max-width:400px;
background-image:url('http://4.bp.blogspot.com/-KWHpPk4f-kM/TdZY_dxWMRI/AAAAAAAAADc/6FHVzBLY-4o/s1600/flower-1.jpg');
background-position:center center;}
</style>


<body>
<div class="photo"></div>

</body>
</html>

关于html - Css 定位和照片大小调整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9111502/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com