괴발개발/Html+CSS

CSS_박스를 이등분으로 나란히

moonday 2021. 6. 10. 00:05

height는 임의로 지정

 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
  
  .all::after{clear: both; content: ''; display: block;}
    .box1{border: 2px solid purple; width: 50%; height: 180px; float: left;
      background-color: pink; box-sizing: border-box;}
    .box2{border: 2px solid orange; width: 50%; height: 180px; float: right;
      background-color: tan; box-sizing: border-box;}

  </style>
</head>
<body class="all">
  <div class="box1"></div><div class="box2"></div>
</body>
</html>

 

'괴발개발 > Html+CSS' 카테고리의 다른 글

CSS_박스 나란히 삼등분하기  (0) 2021.06.10
CSS_박스 안에 박스 이등분 나란히 배열  (0) 2021.06.10
CSS_float  (0) 2021.06.09
CSS_position:fixed;  (0) 2021.06.09
CSS_box-sizing과 padding  (0) 2021.06.09