• 1401/02/22

ساخت فرم لاگین :

سلام و وقت بخیر 

برای ساخت یه فرم لاگین که در وسط صفحه بخوایم قرارش بدیم چطوری باید اینکارو انجام داد؟ 

من تو css بدین شکل انجامش دادم : 


.form-loc {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    
}

.form-box {
    box-shadow: 2px 2px 8px #918d8d;
    border-radius: 8px;
    padding: 20px;
    width: 350px;
}

.form-control {
    display: flex;
    flex-direction: column;
}

.form-box h2 {
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 24px;
    text-align: center;
    margin-bottom: 15px;
}

.input {
    margin-bottom: 10px;
}

  • 1401/02/22
  • ساعت 17:50

اینم کدهای html : 



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login Form</title>
    <link rel="stylesheet" href="./style.css">
    <link rel="stylesheet" href="./Reset CSS/reset.css">
</head>
<body>
    <div class="form-loc">
        <form action="#" class="form-box">
            <h2>Login Form</h2>
            <div class="form-control">
                <input type="text" name="firstname" class="input name-input" placeholder="Enter Your Name">
                <input type="text" name="lastname" class="input last-input" placeholder="Enter Your Lastname">
                <input type="password" name="password" class="input pass-input" placeholder="Enter your password">
                <input type="submit" name="button" class="input btn" value="Submit">
            </div>
        </form>
    </div>
    
    
</body>
</html>

  • 1401/02/23
  • ساعت 11:38

سلام
اتفاقا برای خودمم سوال بود
من خودم مارجینش رو اول auto دادم بعدش یه مارجین تاپ هم بهش دادم


  • 1401/02/23
  • ساعت 14:18

با سلام خدمت شما همراه عزیز

 

با روش prefect centering در فلکس باکس میتونید

با مارجین auto هم میشه خیلی ساده

 

موفق و سربلند باشید