- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一些 div 和输入框。当我调整窗口大小时,div 会适当调整,但输入会被剪裁。如何在最大宽度为 400 像素的情况下将输入调整为屏幕大小?下面是两种状态的截图:Looks good .但是当页面变窄时,div 响应但是 the input gets cut but the divs are good .
这是我输入的样式
.text-input {
display: block;
width: 100%;
font-family: sans-serif;
font-size: 1em;
appearance: none;
border-radius: none;
padding: 0.5em;
border: solid 1px #fff;
box-shadow: inset 1px 1px 2px 1px #707070;
transition: box-shadow 0.3s;
max-width: 400px;
display: inline-block;
}
.text-input:focus,
.text-input.focus {
outline: none;
box-shadow: inset 1px 1px 2px 1px #c9c9c9;
}
我的问题是,我应该如何设置输入的样式以使其与 div 的行为相同?还请问解决方案背后的直觉是什么?
最佳答案
你可以把input
放在一个div
里面,给input
一个width:100%;
。
HTML
<div>
<input type="text" />
</div>
CSS
input[type=text] {
width: 100%;
max-width: 400px;
box-sizing: border-box;
}
div {
border: solid 1px red
}
关于HTML、CSS : Input Box Goes Outside of Viewable Area,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26193932/
我有问题如何在 Go 中打印变量 for,in outside for,in outside for?我正在使用库 GJSON gjson 我尝试了很多方法,我只是输入了全局变量但只是出现了最终索引,
loadJSON(path, callback) { console.log("path: " + path); var xobj = new XMLHttpRequest();
假设我有一个常规的简单 Java 类,例如: public class Foo { private int data; public int getData() { r
如何仅在可能跨越多行的任意长度的文本上实现外边框,必须是响应式的。 寻找类似于下图的样式。 这是我迄今为止尝试过的方法,在顶部边框和对屏幕尺寸的响应能力以及使用各种字体大小(我所拥有的最好的字体大小)
我有一个文本,它是一个 html 文本,我不知道里面有什么(实际上它就像一个文本博客)。 我想做的是用一个带有适当 CSS 的 div 将它括起来,这样我可以确定这个文本中的任何内容(尤其是太大的图片
我正在尝试运行一个并行循环(免责声明:我是并行处理的新手,这可能是一个非常愚蠢的问题)。本质上,我希望能够在并行函数中启动和终止循环,并且能够不时地检查其状态。 我尝试编写一个非常基本的示例(见下文)
我得到了一系列非负整数。 43 18 5 67 1 72 16 17 15 93 38 6 83 10 49 98 7 47 61 52 71 79 82 52 8 我需要将它存储在 Outside-
我有问题。 我想在每个带有“.shadowed”类的图像下添加一个 shadow.jpg 图像。 所以: .shadowed { border: solid 1px #fff; mar
我写了这个CSS: div { width: 500px; height:150px; margin-left:150px; background: lightblue; } div:
我有一种情况,我需要根据对象的日期来验证嵌套对象的日期范围。 因此,假设我有一个名为: Course{ Date date Teacher teacher } Teacher{ Date effect
在 JavaScript 中,我有一个对象数组和一个输入值,如下所示: const inputVal = 'foo'; const objArray = [ {title: 'blahaa',
我想可视化实时传感器数据(流数据)。为此我使用了 node.js、html 和 mysql。 Mysql用于存储实时传感器数据,index.html实现google chart doPoll app.
我有以下代码。有两个枚举。一个有 16 个值 (A_) 和另一个有 15 个值 (A1_)。 #include typedef enum { A_0 = 0, A_1,
我假设这样写对吗 auto && x = ...; 在 for 范围的 for (...) 部分之外几乎没有任何意义,因为如果右侧确实是右值,它通常会停止存在于分号和然后 x 指的是已经被破坏的东西。
list-style-position 时是否无法调整背景图像?是outside ? 示例: li {list-style:decimal;background:url(images/bg-li.pn
我刚刚开始尝试使用 css 中的 shape-outside 属性,但无论我浏览了多少文档或博客,我都无法使其正常工作。我可能犯了一个愚蠢的错误,但我不确定。谁能指出错误? #q { backgr
我是 css 网格的新手 我尝试从附加的图像中实现布局,其中 ONE 元素 DIV 4 比网格布局宽。我尽量避免在 DIV 4 之前关闭 grid-div,然后在 DIV 4 之后再次重新打开网格,这
查看此 code-pen : * { min-height: 100% } #image-sculptor { display: block; height: 321px; width
我想更改字体并加粗 div.main2 之外的元素, 但将元素保留在 div.main2 中不受影响。 我尝试使用 :not(.main2)和 strong *:not(.main2)但逻辑似乎不对
我有一个小设计问题,我似乎无法理解。也许我可以在这里找到一些有创造力的人,他们可以为我指明方向——我相信我现在有创造力障碍:( 在我解释之前,请看下面的例子。这让事情变得更容易: http://jsf
我是一名优秀的程序员,十分优秀!