κ°€μƒμš”μ†Œ(Pseudo Element) μ„ νƒμžμ— μΆ”κ°€ν•˜λŠ” ν‚€μ›Œλ“œ μ„ νƒν•œ μš”μ†Œμ˜ μ§€μ •λœ 뢀뢄에 μŠ€νƒ€μΌ 적용

μ„ νƒμž::before

.required-sign::before {
  content: '*';
  color: #f00;
}
<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>11_pseudoElement</title>
  <link rel="stylesheet" href="./11.css">
</head>
<body>
  <form action="">
    <label for="account" class="required-sign">ID : </label>
    <input type="text" name="account" id="account">
    <br>
    <label for="password" class="required-sign">PW : </label>
    <input type="password" name="password" id="password">
    <br>
    <label for="name">NAME : </label>
    <input type="name" name="name" id="name">
    <br>
  </form>
</body>
</html>

11.JPG

μ„ νƒμž::after

.required-sign::after{
  content: '*';
  color: #f00;
}

<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>11_pseudoElement</title>
  <link rel="stylesheet" href="./11.css">
</head>
<body>
  <form action="">
    <label for="account" class="required-sign">ID : </label>
    <input type="text" name="account" id="account">
    <br>
    <label for="password" class="required-sign">PW : </label>
    <input type="password" name="password" id="password">
    <br>
    <label for="name">NAME : </label>
    <input type="name" name="name" id="name">
    <br>
  </form>
</body>
</html>

22.JPG