<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

    form, input[type=number], input[type=submit] {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 11pt;
    border-radius: 4px;
    display: block;
    }

    input[type=number] {
    width: 300px;
    height: 47px;
    padding: 12px 20px;
    margin: 8px 0;
    box-sizing: border-box;
    border: 2px solid #ccc;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    }

    input[type=submit] {
    background-color: red;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    }

<!-- language: lang-html -->

    <form>
    Número de telefone: <input type="number" name="quantity" min="9000000" max="9999999" title="7 digitos">
    <input type="submit">
    </form>

<!-- end snippet -->

HTML &lt;input type="number"&gt; min max Attribute <https://www.w3schools.com/tags/att_input_max.asp><br/>
HTML &lt;input type="text"&gt; pattern Attribute <https://www.w3schools.com/tags/att_input_pattern.asp><br/>