水平显示内联块或垂直定位

  • 本文关键字:垂直 定位 显示 水平 html css
  • 更新时间 :
  • 英文 :


试图浮动元素或显示内联元素时,它们消失了。不知道为什么这是。这些属性似乎很简单。任何输入都很棒

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>

将最大高点更改为最小

您的DIV的高度为0,因为它的空

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>

max-height更改为min-heightmax-height仅将DIV的最大高度设置为100px,但是在这里您需要设置min-height才能将某些内容纳入DIV

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>

最新更新