首页 > 解决方案 > 如何在文本框中移动用户输入?

问题描述

我试图将用户输入进一步向右移动,因为边框与文本截取并且不会使其看起来整洁。我试图让它在文本前有一个空格,但我无法让它工作。因此,如果有人知道如何解决此问题,我将不胜感激。图片在这里:

在此处输入图像描述

完整代码:

<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>
            Welcome!
        </title>
    </head>
    <style>
        html {
            background-color: cadetblue;
            font-family: Blippo, fantasy;
        }
        .welcomes {
            font-size: 80px;
            font-weight: 900;
            margin-top: 10%;
            color: white;
        }
        .name {
            width: 38%;
            margin-left: 32%;
            height: 30px;
            border-radius: 25px;
            border-color: white;
            outline: none;
            caret-color: cadetblue;
        }
    </style>
    <body>
        <div class="welcomes">
            <center>
            Welcome!
            </center>
        </div>
        <br>
        <br>
        <input type="text" class="name" style="font-family: Blippo, fantasy; color: cadetblue; font-size: 25px;" placeholder=" Please Enter Your Name To Continue!">
    </body>
</html>

标签: htmlcssinputborderpadding

解决方案


用于padding-left输入标签。

<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>
            Welcome!
        </title>
    </head>
    <style>
        html {
            background-color: cadetblue;
            font-family: Blippo, fantasy;
        }
        .welcomes {
            font-size: 80px;
            font-weight: 900;
            margin-top: 10%;
            color: white;
        }
        .name {
            width: 38%;
            margin-left: 32%;
            height: 30px;
            border-radius: 25px;
            border-color: white;
            outline: none;
            caret-color: cadetblue;
        }
    </style>
    <body>
        <div class="welcomes">
            <center>
            Welcome!
            </center>
        </div>
        <br>
        <br>
        <input type="text" class="name" style="font-family: Blippo, fantasy; color: cadetblue; font-size: 25px; padding-left: 20px;" placeholder=" Please Enter Your Name To Continue!">
    </body>
</html>


推荐阅读