gpt4 book ai didi

html - css 向左浮动并输入 100% 宽度

转载 作者:太空宇宙 更新时间:2023-11-03 20:45:44 25 4
gpt4 key购买 nike

我希望输入为 width: 100%; 并且位于图像的右侧。不使用表格是否可能?如果是,我该如何实现?

HTML:

<div class="wrapper">
<img src="http://www.iconpot.com/icon/thumbnail/geek-avatar.jpg" />
<input/>
</div>

CSS:

input {
width:100%;
float:left;
}

FIDDLE

谢谢

最佳答案

你可以用 calc() 来做到这一点

FIDDLE

input
{
width: calc(100% - 130px); /* width of img + extra padding between */
}

您还可以通过设置 img 样式来对齐输入

img
{
vertical-align: middle; /* or top /bottom.. etc */
}

关于html - css 向左浮动并输入 100% 宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21159461/

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