Firefox desktop and Chrome mobile adding mysterious text input width padding
So Firefox desktop and the Chrome mobile app seem to be rendering web pages with extra padding to text input widths (where Chrome desktop displays them as expected):
So far, none of the solutions I've tried from similar Firefox padding issues on StackOverflow thus far seem to resolve this one. Below are Chrome and Firefox inspections of the padding on the text input field (notice how Firefox adds an extra 18.1667 pixels):
Chrome:
Firefox:
The code can be seen below:
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px "Lato", Arial, sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
html css google-chrome firefox padding
add a comment |
So Firefox desktop and the Chrome mobile app seem to be rendering web pages with extra padding to text input widths (where Chrome desktop displays them as expected):
So far, none of the solutions I've tried from similar Firefox padding issues on StackOverflow thus far seem to resolve this one. Below are Chrome and Firefox inspections of the padding on the text input field (notice how Firefox adds an extra 18.1667 pixels):
Chrome:
Firefox:
The code can be seen below:
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px "Lato", Arial, sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
html css google-chrome firefox padding
add a comment |
So Firefox desktop and the Chrome mobile app seem to be rendering web pages with extra padding to text input widths (where Chrome desktop displays them as expected):
So far, none of the solutions I've tried from similar Firefox padding issues on StackOverflow thus far seem to resolve this one. Below are Chrome and Firefox inspections of the padding on the text input field (notice how Firefox adds an extra 18.1667 pixels):
Chrome:
Firefox:
The code can be seen below:
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px "Lato", Arial, sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
html css google-chrome firefox padding
So Firefox desktop and the Chrome mobile app seem to be rendering web pages with extra padding to text input widths (where Chrome desktop displays them as expected):
So far, none of the solutions I've tried from similar Firefox padding issues on StackOverflow thus far seem to resolve this one. Below are Chrome and Firefox inspections of the padding on the text input field (notice how Firefox adds an extra 18.1667 pixels):
Chrome:
Firefox:
The code can be seen below:
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px "Lato", Arial, sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px "Lato", Arial, sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px "Lato", Arial, sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
html css google-chrome firefox padding
html css google-chrome firefox padding
asked Nov 24 '18 at 15:58
Robert James MietaRobert James Mieta
495
495
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I don't know if the situation is different on your computer, but on mine, it's a combination of two factors.
Firstly, apparently, the resulting width of an inputs with a size
attribute is based on the original font, rather than the font given in the stylesheet. Solution: set the width in the stylesheet too, in ch
units.
And the Lato font also seems to cause issues. If I remove that and just use Arial, the result is the same in both browsers.
Hope this helps!
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px 'Arial', sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
width: 8ch; /* new */
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
It very much indeed helped! Thank you!
– Robert James Mieta
Nov 26 '18 at 9:34
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459898%2ffirefox-desktop-and-chrome-mobile-adding-mysterious-text-input-width-padding%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I don't know if the situation is different on your computer, but on mine, it's a combination of two factors.
Firstly, apparently, the resulting width of an inputs with a size
attribute is based on the original font, rather than the font given in the stylesheet. Solution: set the width in the stylesheet too, in ch
units.
And the Lato font also seems to cause issues. If I remove that and just use Arial, the result is the same in both browsers.
Hope this helps!
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px 'Arial', sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
width: 8ch; /* new */
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
It very much indeed helped! Thank you!
– Robert James Mieta
Nov 26 '18 at 9:34
add a comment |
I don't know if the situation is different on your computer, but on mine, it's a combination of two factors.
Firstly, apparently, the resulting width of an inputs with a size
attribute is based on the original font, rather than the font given in the stylesheet. Solution: set the width in the stylesheet too, in ch
units.
And the Lato font also seems to cause issues. If I remove that and just use Arial, the result is the same in both browsers.
Hope this helps!
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px 'Arial', sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
width: 8ch; /* new */
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
It very much indeed helped! Thank you!
– Robert James Mieta
Nov 26 '18 at 9:34
add a comment |
I don't know if the situation is different on your computer, but on mine, it's a combination of two factors.
Firstly, apparently, the resulting width of an inputs with a size
attribute is based on the original font, rather than the font given in the stylesheet. Solution: set the width in the stylesheet too, in ch
units.
And the Lato font also seems to cause issues. If I remove that and just use Arial, the result is the same in both browsers.
Hope this helps!
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px 'Arial', sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
width: 8ch; /* new */
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
I don't know if the situation is different on your computer, but on mine, it's a combination of two factors.
Firstly, apparently, the resulting width of an inputs with a size
attribute is based on the original font, rather than the font given in the stylesheet. Solution: set the width in the stylesheet too, in ch
units.
And the Lato font also seems to cause issues. If I remove that and just use Arial, the result is the same in both browsers.
Hope this helps!
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px 'Arial', sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
width: 8ch; /* new */
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px 'Arial', sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
width: 8ch; /* new */
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
:focus
{
outline: none;
}
.fancy_input_box
{
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input
{
font: 15px/24px 'Arial', sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
width: 8ch; /* new */
}
.fancy_input ~ .fancy_label
{
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus ~ .fancy_label
{
top: -18px;
left: 1px;
font-size: 12px;
color: white !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:not(focus):valid ~ .fancy_label
{
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="thing.css">
</head>
<body style="background-color:grey;">
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="3" size="5" required>
<label class="fancy_label">F00</label>
</div>
</body>
</html>
answered Nov 25 '18 at 8:04
Mr ListerMr Lister
34.6k1074116
34.6k1074116
It very much indeed helped! Thank you!
– Robert James Mieta
Nov 26 '18 at 9:34
add a comment |
It very much indeed helped! Thank you!
– Robert James Mieta
Nov 26 '18 at 9:34
It very much indeed helped! Thank you!
– Robert James Mieta
Nov 26 '18 at 9:34
It very much indeed helped! Thank you!
– Robert James Mieta
Nov 26 '18 at 9:34
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459898%2ffirefox-desktop-and-chrome-mobile-adding-mysterious-text-input-width-padding%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown