1
I own a field input
of the kind text
, but when typing something in this field, value
is leaned against the edge of the input, such as changing the position of the input to get an edge?
1
I own a field input
of the kind text
, but when typing something in this field, value
is leaned against the edge of the input, such as changing the position of the input to get an edge?
4
Who defines the visual aspect is the stylesheet (CSS).
The internal margin in a style sheet is defined by the property padding
.
Styles can be provided "inline", by external files or within a block <style>
See two inline examples and one using class:
<style>
.superborda {padding:50px}
</style>
<input type="text" style="padding:4px" value="um">
<input type="text" style="padding:5px 20px" value="dois">
<input type="text" class="superborda" value="três">
Links that can help:
More advanced techniques:
Who is alive.... always responds...... :)
@Bacco thank you
About links with related things I can’t think much now... unless it’s something related to user-agent maybe, or right/left alignments, input is not going to put a ::after, you should not take out Outline, global input attributes etc... But nothing much related to spacing... I’ll even post a little response, but just for the record...
1
It has some ways to make an edge, without using the original edge of the input, which is placed by the browser’s user-agent.
You can customize a outline
to use as edge, so you have the property outline-offset
to control the offset of the input "edge". Also you can use the pseudo-class :focus
to leave the input
even more customized when the user clicks on it...
Here are some examples. The dotted edge is what would be the original border of input
. The against of outline
is that you can’t control each side as in padding: 5px 10px;
from the @Acco response, I believe his response may be more versatile, but I’ll leave this one just for the record.
input {
border: 1px dashed #ddd;
outline: 1px solid blue;
outline-offset: 10px;
margin: 10px;
}
input:focus {
outline: 1px solid blue;
}
input:nth-child(2) {
outline-offset: 0px;
}
input:nth-child(2):focus {
outline-offset: 10px;
outline: 1px solid rgb(0, 255, 255);
border:none;
}
<input type="text" value="123">
<input type="text" value="clica aqui">
very good tip, thanks.
@Gabrielferreira without problems ;)
Browser other questions tagged html css
You are not signed in. Login or sign up in order to post.
Use the CSS padding property in input.
– Leandro Nascimento