代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>表单必填项</title>
<style type="text/css">
.form-item label:before {
content: '*';
color: #e54d42;
font-size: 100%;
}
</style>
</head>
<body>
<form action="" method="">
<div class="form-item">
<label for="url_input">必填项:</label>
<input type="text" id="url_input" />
</div>
</form>
</body>
</html>