[英]How can align my text from center to left?
I am designing a simple signup form using Html and CSS.我正在使用 Html 和 CSS 设计一个简单的注册表单。 I just want to " already have an account? Log in" text to left till the border of skyblue border, butI am unable to do that.
我只想“已经有一个帐户?登录”文本左到天蓝色边框的边框,但我无法做到这一点。
But I am getting result但我得到了结果
Here is my html code这是我的 html 代码
<div class="register-bg">
<div class="register-container">
<form>
<label for="email"><b>Email</b></label>
<input
type="text"
placeholder="Enter Email"
name="email"
required=""
/>
<label for="password"><b>Password</b></label>
<input
type="password"
placeholder="Enter Password"
name="password"
required=""
/>
<button type="submit" class="signup">Sign Up</button>
<Link>
<h1 class="register-login">
alredy have an account ? Log in
</h1>
</Link>
</form>
</div>
</div>
Here is my css code这是我的 ZC7A628CBA22E28EB17B5F5C6AE2A266AZ 代码
.register-bg{
height: 100vh;
background-size: cover;
width: 100%;
background-image: url(../public/images/bg.jpg);
}
.register-container{
margin-top: 100px;
display: flex;
flex-wrap: wrap;
flex-direction: row;
width: 70%;
margin-left:27rem;
background: rgb(53, 105, 46);
align-items: center;
justify-content: center;
padding: 50px 0;
}
.register-container > form{
background:skyblue;
display: flex;
flex-wrap: wrap;
flex-direction: column;
width: 70%;
justify-content: center;
align-items: center;
}
.register-container input{
width: 80%;
font-size: 15px;
padding: 15px;
margin: 5px 0 22px 0;
display: inline-block;
text-align: center;
border: none;
background: #f1f1f1;
}
.register-login {
color: black;
font-size: 15px;
}
.signup{
align-items: center;
font-size: 14px;
font-weight: bold;
background-color: rgb(10, 119, 13);
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
opacity: 0.9;
}
Just add this to your CSS:只需将此添加到您的 CSS 中:
.register-login {
align-self: flex-start;
}
Wrap your <Link>
in a div
container将您的
<Link>
包装在div
容器中
<div class="login-text-container">
<Link>
<h1 class="register-login">
alredy have an account ? Log in
</h1>
</Link>
</div>
Wet its width to 100%将其宽度润湿至 100%
.login-text-container {
width: 100%;
}
.register-bg { height: 100vh; background-size: cover; width: 100%; background-image: url(../public/images/bg.jpg); }.register-container { margin-top: 100px; display: flex; flex-wrap: wrap; flex-direction: row; width: 70%; margin-left: 27rem; background: rgb(53, 105, 46); align-items: center; justify-content: center; padding: 50px 0; }.register-container>form { background: skyblue; display: flex; flex-wrap: wrap; flex-direction: column; width: 70%; justify-content: center; align-items: center; }.register-container input { width: 80%; font-size: 15px; padding: 15px; margin: 5px 0 22px 0; display: inline-block; text-align: center; border: none; background: #f1f1f1; }.register-login { color: black; font-size: 15px; }.signup { align-items: center; font-size: 14px; font-weight: bold; background-color: rgb(10, 119, 13); color: white; padding: 14px 20px; margin: 8px 0; border: none; cursor: pointer; opacity: 0.9; }.login-text-container { width: 100%; }
<div class="register-bg"> <div class="register-container"> <form> <label for="email"><b>Email</b></label> <input type="text" placeholder="Enter Email" name="email" required="" /> <label for="password"><b>Password</b></label> <input type="password" placeholder="Enter Password" name="password" required="" /> <button type="submit" class="signup">Sign Up</button> <div class="login-text-container"> <Link> <h1 class="register-login"> alredy have an account? Log in </h1> </Link> </div> </form> </div> </div>
add the following code, edit it and you are good to go:)添加以下代码,编辑它,你对 go 很好:)
CSS: CSS:
.login-button {
display: block;
padding: 100%;
align-items: left;
}
HTML: HTML:
<div class='login-button'>
<h1 class="register-login">
alredy have an account ? Log in
</h1>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.