How can I put this static text in an input form?
It's there all the time.
This is my code:
<label for="subdomain">Subdomain:</label>
<input type="text" placeholder="ExampleDomain" id="subdomain"/>
You can achieve this with the following approach:
<input>
in a <label>
with position:relative
<label>
an ::after
pseudo-element with position:absolute
box-sizing
of the <input>
to border-box
<input>
a padding-right
equal to the width of the ::after
pseudo-elementWorking Example:
label, input {
position: relative;
display: block;
padding-right: 76px;
width: 174px;
box-sizing: border-box;
}
label::after {
content: '.' attr(data-domain);
position: absolute;
top: 4px;
left: 96px;
font-family: arial, helvetica, sans-serif;
font-size: 12px;
display: block;
color: rgba(0, 0, 0, 0.6);
font-weight: bold;
}
<label data-domain="domain.com">
<input type="text" placeholder="exampledomain" />
<label>
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