登录屏幕在一行上确认密码

问题描述:

所以我对整个HTML/CSS的东西很陌生,我学到的大部分东西都是来自这里或者是我用Google的问题,我差不多完成了我的任务,但是我似乎无法弄清楚如何在同一行上打印两个标签单词。 https://i.stack.imgur.com/TRdxs.png登录屏幕在一行上确认密码

[<!DOCTYPE html> 
<html> 
<head> 
<meta charset="UTF-8"> 
<title></title> 
<style> 
body {background-color: black;} 
div {} 
label {display:inline-block;width:235px;margin-left: 20px; margin-top: 20px; font-size: 25px; font-family: Calibre; color: white; text-align: left;} 
input {margin-top: 20px; margin-right: 20px;padding: 12px 20px;} 
#main {border: 5px solid white; width: 600px; height: 400px;} 
button {margin-left: 320px; margin-top: 20px; margin-bottom: 20px; background-color:#00BB00; width:120px; height: 40px; 
color: white; 
font-size: 20px; 
border-radius: 46px; 
-moz-border-radius: 46px; 
-webkit-border-radius: 46px; 
border: 0px solid #800000; 
font-family: Calibre} 
</style> 
</head> 
<body> 
<div id="main"> 
<form action="/web.engineering" method="post"> 
    <div> 
    <label>Username:</label> 
    <input type="text"placeholder="Username" name="username" required> 
    </div> 
    <div> 
    <label>First name:</label> 
    <input type="text" placeholder="First name" name="firstname" required> 
    </div> 
    <div> 
    <label>Last name:</label> 
    <input type="text" placeholder="Last name" name="lastname" required> 
    </div> 
    <div> 
    <label>Password:</label> 
    <input type="password" placeholder="Enter password" name="password" required> 
    </div> 
    <div> 
    <label>Passwordconfirmation:</label> 
    <input type="password" placeholder="Re-enter password" name="Repeat password" required> 
    </div> 
    <div> 
    <button type="submit" ><b>Register</b></button> 
    </div> 
</form> 

</div> 

</body> 
</html>][1] 

所以这是我和画面是什么,我要get.Can请你告诉我如何在文本框中之前在同一行打印密码确认。 在此先感谢

+0

您能否提供预期输出的图像?或者更加解释什么是问题? –

+0

尝试使用#main div显示:内嵌块属性。 –

根据空间容器div有,第二个使用display: flex;flex-basis: 230px;

body { 
 
    background-color: black; 
 
} 
 

 
div {} 
 

 
#main form>div { 
 
    display: flex; 
 
} 
 

 
label { 
 
    flex-basis: 230px; 
 
    margin-left: 20px; 
 
    margin-top: 20px; 
 
    font-size: 23px; 
 
    font-family: Calibre; 
 
    color: white; 
 
    text-align: left; 
 
} 
 

 
input { 
 
    margin-top: 20px; 
 
    margin-right: 20px; 
 
    padding: 12px 20px; 
 
} 
 

 
#main { 
 
    border: 5px solid white; 
 
    width: 600px; 
 
    height: 400px; 
 
} 
 

 
button { 
 
    margin-left: 320px; 
 
    margin-top: 20px; 
 
    margin-bottom: 20px; 
 
    background-color: #00BB00; 
 
    width: 120px; 
 
    height: 40px; 
 
    color: white; 
 
    font-size: 20px; 
 
    border-radius: 46px; 
 
    -moz-border-radius: 46px; 
 
    -webkit-border-radius: 46px; 
 
    border: 0px solid #800000; 
 
    font-family: Calibre 
 
}
<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <meta charset="UTF-8"> 
 
    <title></title> 
 
    <style> 
 

 
    </style> 
 
</head> 
 

 
<body> 
 
    <div id="main"> 
 
    <form action="/web.engineering" method="post"> 
 
     <div> 
 
     <label>Username:</label> 
 
     <input type="text" placeholder="Username" name="username" required> 
 
     </div> 
 
     <div> 
 
     <label>First name:</label> 
 
     <input type="text" placeholder="First name" name="firstname" required> 
 
     </div> 
 
     <div> 
 
     <label>Last name:</label> 
 
     <input type="text" placeholder="Last name" name="lastname" required> 
 
     </div> 
 
     <div> 
 
     <label>Password:</label> 
 
     <input type="password" placeholder="Enter password" name="password" required> 
 
     </div> 
 
     <div> 
 
     <label>Password confirmation:</label> 
 
     <input type="password" placeholder="Re-enter password" name="Repeat password" required> 
 
     </div> 
 
     <div> 
 
     <button type="submit"><b>Register</b></button> 
 
     </div> 
 
    </form> 
 

 
    </div> 
 

 
</body> 
 

 
</html>]

希望这将工作首先给字体大小!

+0

谢谢你的工作就像一个魅力^^ –

+0

@СимеонПецанов - 你的欢迎,请你给我投票:) –

+0

我与低于15的声望,投票记录,但不可见。一刻我打你应该得到的声誉你的投票:(对不起,关于那 –

使标签的宽度大于或小于标签的字体大小。既然你有固定的宽度,那么这两个单词都不适合该字体大小的235px的宽度。我试着宽度为240px,它位于同一行,并且字体大小为24px,它位于同一行。