I just received this visual design:
CLG is a label
tag, while the line is an input type=tel
Just ignore the purple overlay...
The designer asks me to remove the border as the user types a new number.
Is that possible?
Also, you can remove the default borders on certain sides by setting them to "transparent". See another example where the outline: none; is set for <input>, <textarea> and <select> fields.
When you add a TextField in your NativeScript app, by default it has no border on iOS, but on Android, there is a persistent border at the bottom. This is part of material design and it comes out of the box in NativeScript.
TextField widget has a property decoration which has a sub property border: InputBorder.none .This property would Remove TextField Text Input Bottom Underline in Flutter Android iOS mobile app. The bottom underline shows us how much area in width Text Input is occupying on mobile screen. 1. Import material.dart package in your app’s main.dart file.
Remove the outline and add a border style using the :focus and :active pseudo-classes with the <input> field. You can also remove the default borders on specific sides by setting them to "transparent".
It is definitely possible, however it includes
The idea is basically to mimick the border with a :after
pseudo-element and shrink it to the remaining width of the <label>
.
// https://css-tricks.com/snippets/javascript/loop-queryselectorall-matches/
[].forEach.call(document.querySelectorAll('input'), function(element) {
element.addEventListener('input', function() {
element.size = element.value.length;
});
});
label {
display: flex;
align-items: stretch;
font-weight: bold;
}
label:after {
content: '';
display: block;
width: 100%;
border-bottom: 1px solid gray;
}
input {
display: block;
border: none;
}
<form>
<label>CLG <input type="tel" size="1"></label>
</form>
Instead of input
element, I used a div element with contenteditable
property.
.wrapper {
border-bottom: 1px solid black;
width: 250px;
height: 25px;
white-space: nowrap;
}
.wrapper > div {
display:inline-block;
vertical-align: middle;
height: 100%;
}
.text {
position: relative;
min-width:10px;
}
.text:after {
content:"";
border-top: 1px solid white;
border-bottom: 1px solid white;
top: -1px;
bottom: -1px;
left: 0px;
width: 100%;
position: absolute;
}
.text:focus {
outline: none;
}
Working Fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With