html - 自定义输入文本框的内置标题栏边框

标签 html css angular typescript

输入文本框中标题的轮廓颜色在谷歌浏览器中显示不同。底部边框线看起来不同。

<input type="text" title="Please fill out this field.">

enter image description here

所以我尝试了以下代码:

<span class="pseudo-tooltip-wrapper" data-title="please fill out this field...">
<input type='text' required></span>

示例.css

[data-title]:hover:after {
    opacity: 1;
    transition: all 0.1s ease 0.5s;
    visibility: visible;
}

[data-title]:after {
    content: attr(data-title);
    background-color: rgb(217, 235, 217);
    color: #111;
    font-size: 150%;
    position: absolute;
    padding: 1px 5px 2px 5px;
    bottom: -1.6em;
    left: 100%;
    white-space: nowrap;
    /* box-shadow: 1px 1px 3px #222222; */
    opacity: 0;
    border: 1px solid #111111;
    z-index: 99999;
    visibility: hidden;
}

[data-title] {
    position: relative;
}

.pseudo-tooltip-wrapper {
    /*This causes the wrapping element to be the same size as what it contains.*/
    display: inline-block;
}

所以现在它显示如下。当我根据需要创建字段时,将显示默认标题栏。

我们可以修复默认的标题栏边框,而不是这种方法。

enter image description here

请在stackbliz中找到代码:https://stackblitz.com/edit/angular-pa2lnu

如何实现这个问题。

最佳答案

您可以使用 Angular Material 输入表单字段,它们更简单、全面且具有装饰性。如果你找到了请告诉我 [此链接] ( https://material.angular.io/components/form-field/overview ) 有帮助

关于html - 自定义输入文本框的内置标题栏边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59085967/

相关文章:

html - 如何在 html/css 中使用字体

jquery - 简单的 HTML jQuery 滚动条/ slider

html - HTML5 中隐藏表单控件的处理有意义吗?

javascript - 如何用独立于高度的图像覆盖 div?

Angular Header/Http/RequestOptions 自 angular 6.0 以来已弃用,如何将它们更新到 angular 8.0?

Angular cli 忽略文件以进行缩小

html - 仅 CSS 响应式菜单不会在页面加载时关闭

html - 如何停止我的列表与标题图片重叠?

带有 :before and :after 边框的 CSS 点

javascript - ionic 3 : Using result from JSON response in second GET call