- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
请看一下这个错误的以下简化版本:
.wrap {
white-space: pre-wrap;
}
<div>
<input type="date" class="wrap">
</div>
最佳答案
看来您在 Firefox 中发现了一个有趣的错误。
A. 首先建议(!)解决方案
简单:不要使用 whitespace: pre-wrap
至<input type="date">
或 <input type="time">
.你仍然不需要这个......显然浏览器开发人员不希望有人这样做,这样开发人员还没有发现这种行为。
真的很难想象属性 whitespace: pre-wrap
的任何原因或情况。需要习惯那个元素。日期不会自行流向下一行。
B. 背景(你要求的原因)
具有包含功能的元素,如 date-/time-picker
有额外的隐藏内部元素。对于 <input type="date"
通常看不到的结构如下:
<div id="input-box-wrapper" class="datetime-input-box-wrapper">
<span id="edit-wrapper" class="datetime-input-edit-wrapper"></span>
<button id="reset-button" class="datetime-reset-button"></button>
</div>
// you can see this normally hidden structure in Firefox using the developer tools
// when 'white-space: pre-wrap' is set to the element ...
该元素的 CSS 放置在浏览器集成样式中,您通常无法通过 css/js 访问/覆盖。特别是在 Firefox 中这是不可能的,因为开发人员根本没有打算删除 Firefox 中的日期/时间行为的方法。
// file: datetimebox.css
// you may have a look on them using Firefox dev tools as well
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@namespace url("http://www.w3.org/1999/xhtml");
@namespace svg url("http://www.w3.org/2000/svg");
.datetimebox {
display: flex;
/* TODO: Enable selection once bug 1455893 is fixed */
user-select: none;
}
.datetime-input-box-wrapper {
display: inline-flex;
flex: 1;
background-color: inherit;
min-width: 0;
justify-content: space-between;
align-items: center;
}
.datetime-input-edit-wrapper {
overflow: hidden;
white-space: nowrap;
flex-grow: 1;
}
.datetime-edit-field {
display: inline;
text-align: center;
padding: 1px 3px;
border: 0;
margin: 0;
ime-mode: disabled;
outline: none;
}
.datetime-edit-field:not([disabled="true"]):focus {
background-color: Highlight;
color: HighlightText;
outline: none;
}
.datetime-edit-field[disabled="true"],
.datetime-edit-field[readonly="true"] {
user-select: none;
}
.datetime-reset-button {
color: inherit;
fill: currentColor;
opacity: .5;
background-color: transparent;
border: none;
flex: none;
padding-inline: 2px;
}
svg|svg.datetime-reset-button-svg {
pointer-events: none;
}
汇集所有:
.datetime-reset-button
.自行证明:使用
white-space: pre-wrap
对于
input
让“增长”将按钮包装元素重置为给定的高度。如果您现在添加
display: none
(在 Firefox 中直接)在浏览器中集成样式到该元素的行为
input
元素被删除,
input
的大小变回正常状态。
white-space: pre-wrap
更改字段的行为并保留空白序列的位置(更多详细信息:
https://developer.mozilla.org/en-US/docs/Web/CSS/white-space)。正常行为是,属性
display: inline-flex
从 reset-button-container 的父元素让容器内联流动并流动到下一行。如果设置
white-space: wrap
您可以在输入字段下方的下一行中看到该按钮。 (看到这似乎也是一个错误。)但是对于
pre-wrap
流程不再可能,并且在该字段中按下按钮......让它长得更高。
关于javascript - Firefox Android 中 "input"和 "white-space:pre-wrap"的高度大于 Android 中的 Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64331670/
我有两个文本输入元素 A 和 B。 我希望用户能够从 A 中选择部分或全部文本并拖动到 B,但文本不会从 A 中消失。 假设“A”包含“quick brown fox”,用户突出显示“fox”一词并将
我正在一个网站上工作,如果在提交表单之前数字不在最小值和最大值之间,我希望数字输入能够自行更正。我的代码如下: HTML: JavaScript: function CorrectOverUnder
在检查输入值是否存在并将其分配给变量时,我看到了两种实现此目的的方法: if(Input::has('id')) { $id = Input::get('id'); // do som
我意识到 有一个 border-box盒子模型,而有一个 content-box盒子模型。此行为存在于 IE8 和 FF 中。不幸的是,这使我无法将这种样式应用于大小均匀的输入: input, tex
在 Polymer 文档 ( https://elements.polymer-project.org/elements/iron-input ) 中,我发现: 而在另一个官方文档(https://
我使用 jquery 添加/删除输入 我使用append为日期/收入添加多个Tr 我还使用另一个附加来添加多个 td 以获取同一日期 Tr 中的收入 我添加多个日期输入,并在此表中添加多个收入输入 我
Python3 的 input() 似乎在两次调用 input() 之间采用旧的 std 输入。有没有办法忽略旧输入,只接受新输入(在 input() 被调用之后)? import time a =
在一些教程中,我看到了这些选择器: $(':input'); 或 $('input'); 注意“:”。 有什么不同吗? 最佳答案 $('input') = 仅包含元素名称,仅选择 HTML 元素。 $
我有下一个 html 表单: Nombre: El nombre es obligatorio. Solo se pe
有两种方法可以在组件上定义输入: @Component({ inputs: ['displayEntriesCount'], ... }) export class MyTable i
input: dynamic input is missing dimensions in profile onnx2trt代码报错: import numpy as np import tensor
所以,我有允许两个输入的代码: a, b = input("Enter a command: ").split() if(a == 'hello'): print("Hi") elif(a =
我有一个与用户交流的程序。我正在使用 input() 从用户那里获取数据,但是,我想告诉用户,例如,如果用户输入脏话,我想打印 You are swearing!立即删除它! 而 用户正在输入。 如您
我在运行 J2ME 应用程序时遇到了一些严重的内存问题。 所以我建立了另一个步骤来清除巨大的输入字符串并处理它的数据并清除它。但直到我设置 input = null 而不是 input = "" 才解
我想在我的 android 虚拟设备中同时启用软输入和硬键盘。我知道如何两者兼得,但不会两者。 同时想要BOTH的原因: 软输入:预览当键盘缩小屏幕时布局如何调整大小 硬键盘:显然是快速输入。 提前致
我有一个邮政编码字段,在 keyup 上我执行了一个 ajax 调用。如果没有可用的邮政编码,那么我想添加类“input-invalid”。但问题是,在我单击输入字段的外部 某处之前,红色边框验证不会
根据我的理解使用 @Input() name: string; 并在组件装饰器中使用输入数组,如下所示 @Component({ ... inputs:
我有一段代码是这样的 @Component({ selector: 'control-messages', inputs: ['controlName: control'],
在@component中, @input 和@output 属性代表什么以及它们的用途是什么? 什么是指令,为什么我们必须把指令放在下面的结构中? directives:[CORE_DIRECTIVE
有没有一种方法可以测试变量是否会使SAS中的INPUT转换过程失败?或者,是否可以避免生成的“NOTE:无效参数”消息? data _null_; format test2 date9.; inp
我是一名优秀的程序员,十分优秀!