♔ 목차

    기본적인 form 양식 style 코드 :

    <style>
    form {
            max-width: 500px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f2f2f2;
            border-radius: 5px;
    }
    
    label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
    }
    
    input[type="text"],
    input[type="email"],
    textarea {
            width: 100%;
            padding: 10px;
            margin-bottom: 20px;
            border: none;
            border-radius: 5px;
            background-color: #fff;
            box-shadow: 0 0 5px rgba(0,0,0,0.1);
    }
    
    input[type="submit"] {
            display: block;
            width: 100%;
            padding: 10px;
            border: none;
            border-radius: 5px;
            background-color: #4CAF50;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
    }
    
    input[type="submit"]:hover {
            background-color: #3e8e41;
    }
    <style>
    <!DOCTYPE html>
    <html>
    <head>
            <title>My Form</title>
            <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    <body>
            <form>
                    <label for="name">Name:</label>
                    <input type="text" id="name" name="name" required>
    
                    <label for="email">Email:</label>
                    <input type="email" id="email" name="email" required>
    
                    <label for="message">Message:</label>
                    <textarea id="message" name="message" required></textarea>
    
                    <input type="submit" value="Submit">
            </form>
    </body>
    </html>

     

    폼 태그만 :

    <style>
    form {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 50px;
    }
    
    label {
      font-size: 18px;
      margin-bottom: 10px;
    }
    
    input,
    textarea {
      padding: 10px;
      border: 2px solid #ccc;
      border-radius: 5px;
      width: 100%;
      margin-bottom: 20px;
    }
    
    button {
      background-color: #4CAF50;
      color: white;
      padding: 10px 20px;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      font-size: 18px;
    }
    button:hover {
      background-color: #3e8e41;
    }
    </style>
    <form>
      <label for="name">Name:</label>
      <input type="text" id="name" name="name" required>
    
      <label for="email">Email:</label>
      <input type="email" id="email" name="email" required>
    
      <label for="message">Message:</label>
      <textarea id="message" name="message" required></textarea>
    
      <button type="submit">Submit</button>
    </form>

     

    Preview <form></form> Code Sample: