PSEUDO SELECTOR

2020/CSS 2020. 2. 16. 17:55
반응형
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Selectors and Pseudo Selectors</title>
  <style>
  
  /*PSEUDO SELECTOR*/
  input[required="required"]{
    background-color: red;
  }
  /*.box:first-child(){}
  .box:last-child(){}
  .box:nth-child(2){} */ 
  .box:nth-child(3n+2){
    background-color: pink;
  }
  /*.container 클래스의 직계 .box만 적용 */
  .container > .box{
    background-color: yellow;
  } */
  .box{
    border:1px solid yellow;
  }
  .box{
    background-color: green;
    display: block;
    height: 100px;
    border:1px solid black;
  }
  .child{
    width: 40px;
  }
  </style>
</head>
<body>
<div class="container">
  <div class="box">
    <div class="box child"></div>
  </div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box">
    <input type="password" required="required" />
    <input type="submit" required="required" />
  </div>
</div>
</body>
</html>

출처: NOMAD CODER

반응형

'2020 > CSS' 카테고리의 다른 글

CSS Transition  (0) 2020.02.16
css states(hover, active, focus, visited)  (0) 2020.02.16
NTH TEST SITE  (0) 2020.02.16
CSS FLEX PRACTICE  (0) 2020.02.16
CSS POSITION  (0) 2020.02.16
블로그 이미지

꽃꽂이하는개발자

,