How to display float box and content inside parent box as a container with CSS and HTML

1 Answer

0 votes
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link rel="stylesheet" href="style.css" />
  <title>Browser</title>
</head>
<div class="box">
  <div class="float">float box</div>
  <p>content inside the container</p>
</div>
</body>
</html>
.box {
  background-color: rgb(145, 205, 239);
  border: 2px solid purple;
  display: flow-root;
}

.float {
  float: left;
  width: 200px;
  height: 150px;
  background-color: white;
  border: 1px solid black;
  padding: 10px;
}

 



answered May 17, 2024 by avibootz

Related questions

2 answers 119 views
119 views asked Jun 18, 2023 by avibootz
4 answers 364 views
1 answer 233 views
1 answer 170 views
5 answers 395 views
5 answers 430 views
...