Search code examples
htmlcssformsinput

How to add static text inside an input form


How can I put this static text in an input form?

It's there all the time.

Enter image description here

This is my code:

<label for="subdomain">Subdomain:</label>
<input type="text" placeholder="ExampleDomain" id="subdomain"/>

Solution

  • HTML

    <label for="subdomain">Subdomain:</label>
    <input type="text" placeholder="ExampleDomain" id="subdomain" />
    <input type="text" id="subdomaintwo" value=".domain.com" disabled/>
    

    CSS

    input[type="text"]#subdomaintwo{
        -webkit-appearance: none!important;
        color: red;
        text-align: right;
        width: 75px;
        border: 1px solid gray;
        border-left: 0px;
        margin: 0 0 0 -7px;
        background: white;
    }
    input[type="text"]#subdomain{
        -webkit-appearance: none!important;
        border: 1px solid gray;
        border-right: 0px;
        outline: none;
    }
    

    JS Fiddle for this