gpt4 book ai didi

html - “粘贴”图像到页面右侧

转载 作者:太空宇宙 更新时间:2023-11-04 15:26:41 27 4
gpt4 key购买 nike

我最后的问题不是很清楚,我再试一次。

在我的 Tumblr 博客 (http://anti-standard.tumblr.com) 上,您可以看到一张图片(图片上写着“ANTI STANDARD”)贴在页面的左侧。但是,我希望图像贴在页面的右侧。我怎样才能做到这一点?我有以下 CSS 代码:

.image-container1 {
width:100%;
position:absolute;
float:right;
right:0;
clear:both;
}

.image-container2 {
background:url('http://avare.nl/tumblr/as.png') no-repeat fixed;
background-size:55px 500px;
height:500px;
width:55px;
}

“正文”标签下方的以下 HTML 代码:

<div class="image-container1">
<div class="image-container2">
</div>
</div>

我希望你们能帮我解决这个问题。

最佳答案

float:right 添加到.image-container2 并从背景中移除fixed

.image-container2 {
background:url('http://avare.nl/tumblr/as.png') no-repeat;
background-size:55px 500px;
height:500px;
width:55px; float:right;
}​

DEMO

或者以简单的方式这样做

HTML

<div class="image-container1">lorem ...</div>

CSS

html, body{height:100%}
.image-container1 {
width:100%;
background:url('http://avare.nl/tumblr/as.png') no-repeat right top;
background-size:55px 500px;
height:100%
}

DEMO

关于html - “粘贴”图像到页面右侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13933051/

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