How can CSS be used to style form fields in PHP?

To style form fields in PHP using CSS, you can add inline styles directly to the form elements or include a CSS file in your PHP code that defines the styles for the form fields. By adding CSS styles, you can customize the appearance of form fields such as input boxes, dropdowns, buttons, etc., to match the design of your website.

<!DOCTYPE html>
<html>
<head>
    <title>Styled Form Fields</title>
    <style>
        input[type="text"], select {
            padding: 5px;
            margin: 5px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        
        input[type="submit"] {
            padding: 5px 10px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <form action="submit.php" method="post">
        <input type="text" name="name" placeholder="Name">
        <select name="gender">
            <option value="male">Male</option>
            <option value="female">Female</option>
        </select>
        <input type="submit" value="Submit">
    </form>
</body>
</html>