dex last dex last - 10 days ago 6
CSS Question

displaying inline block or positioning horizontally instead of vertically

When trying to float elements or display inline they vanish. Not sure why this is. those properties seem pretty straight forward. Any input would be great



body {
background-color: grey;
}

.divison1 {
background-color:blue;
min-width: 100px;
min-height: 100px;
}
.division2 {
background-color: green;
max-width: 100px;
min-height: 100px;
}

<!DOCTYPE>
<html>
<head>
<title> Practice with divs!</title>
<link href = "style.css" type = "text/css" rel = "stylesheet"/>
</head>
<body>
<div class = "divison1"></div>
</body>
</html>




Answer

change max-height to min-height

the height of your div is 0 because its empty

body {
  background-color: grey;
}

.divison1 {
  background-color:blue;
  min-width: 100px;
  min-height: 100px;
}
<!DOCTYPE>
<html>
<head>
  <title> Practice with divs!</title>
  <link href = "style.css" type = "text/css" rel = "stylesheet"/>
</head>
<body>
<div class = "divison1"></div>
</body>
</html>