简体   繁体   English

如何创建带有国家代码的自定义手机号码输入框 - HTML

[英]How to create a custom mobile number input box with country code - HTML

I am trying to create a custom mobile input box with mobile number and country code separated by a divider but unable to do it.我正在尝试创建一个自定义移动输入框,其中包含由分隔线分隔的手机号码和国家/地区代码,但无法做到。

Design设计

移动的

Current Implementation当前实施

          
<div class="col-md-6">
    <p>Mobile</p>
    <div class="form-group mt-2">
        <input type="text" class="form-control" id="ec-mobile-number" aria-describedby="emailHelp"
                              placeholder="91257888" />
    </div>
</div>
                        

Would be great if someone can help with this.如果有人可以提供帮助,那就太好了。

Here is a 5 mins quick solution for you, feel free to enhance;)这是一个 5 分钟的快速解决方案,请随时增强;)

 .form-group { border: 1px solid #ced4da; padding: 5px; border-radius: 6px; width: auto; }.form-group:focus { color: #212529; background-color: #fff; border-color: #86b7fe; outline: 0; box-shadow: 0 0 0 0.25rem rgb(13 110 253 / 25%); }.form-group input { display: inline-block; width: auto; border: none; }.form-group input:focus { box-shadow: none; }
 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet"/> <div class="container mt-2"> <div class="col-md-6"> <p>Mobile</p> <div class="form-group mt-2 d-inline-block"> <span class="border-end country-code px-2">+60</span> <input type="text" class="form-control" id="ec-mobile-number" aria-describedby="emailHelp" placeholder="91257888" /> </div> </div> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用手机号码输入字段添加国家代码 - How to add country code with mobile number input field 如果可以使用国家代码,如何在 HTML 中创建电话格式输入 - How to create phone format input in HTML if it's possible with country code 如何使用国家/地区的所有城市创建输入列表html5? 有可能吗 - How create an input list html5 with all cities of country ? Is possible? 如何在 html 中获取输入字段以确保模式包含特定国家/地区代码,例如 1472,后跟 3 个数字,然后是 4 个数字 - how do I get an input field in html to ensure the pattern contains a specific country code eg 1472 followed by 3 number and then 4 numbers 自定义有效期输入框html - Custom validity input box html 如何在HTML中写入可点击的电话号码,这是没有国家/地区代码的本地电话号码 - How to Write Clickable Telephone Number in Html which is Local Area Number without Country Code 创建自定义html输入 - Create custom html input 如何在html中制作像数字分隔符这样的输入框? - How to make a input box like Number seperator in html? 使用自定义UI创建html框 - create html box with custom UI 如何使用angular 6中的ngx-international-phone-number阻止用户在html页面中编辑国家/地区代码 - How to stop the user editing the country code in a html page using ngx-international-phone-number in angular 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM