gpt4 book ai didi

html - 将图像 float 到 DIV 之外

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

我目前在从 div 中放置图像时遇到问题。无论 div 屏幕大小如何,我都希望图像 float 在屏幕的最右侧。

我构建了一个 DEMO 对于我面临的问题。

CSS:

.outer{
background:cyan;
position:relative;
width:700px;
height:475px;
}
.inner{
width:370px;
color:#fff;
position:absolute;
background:red;
top:35px;
}

根据解决方案,图像应如下所示

enter image description here

最佳答案

它可能会帮助你尝试这个

.inner
{
width:100%;
color:#fff;
position:absolute;
background:red;
top:35px;
}

demo

另一个没有内联样式的demo

.inner .col-sm-6:nth-child(1)
{
padding-top:10px;
width:20%;
float:left;
}
.anotherdiv
{
width:80%;
float:left;
padding:0;
}
.anotherdiv img{
widh:100%;
}

我只是在这做这些改变

see demo here

关于html - 将图像 float 到 DIV 之外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28824344/

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