Html 分词div中的中心垂直非容器
我试图简化我的问题,我在网上搜索;但我没能把这些数字垂直居中;请帮忙。我已经包括了CSS和HTML 这个文本是不需要的,该网站只需要我添加更多的文本,我提交Html 分词div中的中心垂直非容器,html,twitter-bootstrap,css,Html,Twitter Bootstrap,Css,我试图简化我的问题,我在网上搜索;但我没能把这些数字垂直居中;请帮忙。我已经包括了CSS和HTML 这个文本是不需要的,该网站只需要我添加更多的文本,我提交 <!DOCTYPE html> <html lang="en"> <head> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapc
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
.colors2, .colors3 {
background-color: lightgrey;
height: 80px;
text-align: center;
font-weight: bold;
font-size: 26px;
}
.colors2:hover, .colors3:hover {
background-color: grey;
}
.colors3 {
font-weight: normal;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row colors1">
<div class="col-sm-2 colors3">
<span>6</span>
</div>
<div class="col-sm-2 colors2">
<span>7</span>
</div>
<div class="col-sm-2 colors2">
<span>8</span>
</div>
<div class="col-sm-2 colors2">
<span>9</span>
</div>
<div class="col-sm-2 colors3">
<span>5</span>
</div>
<div class="col-sm-2">
<span></span>
</div>
</div>
</div>
</body>
</html>
.colors2、.colors3{
背景颜色:浅灰色;
高度:80px;
文本对齐:居中;
字体大小:粗体;
字号:26px;
}
.colors2:悬停,.colors3:悬停{
背景颜色:灰色;
}
.颜色3{
字体大小:正常;
}
6.
7.
8.
9
5.
使用css3 flex属性。这很有效
.colors2、.colors3{
背景颜色:浅灰色;
高度:80px;
文本对齐:居中;
字体大小:粗体;
字号:26px;
}
.colors2:悬停,.colors3:悬停{
背景颜色:灰色;
}
.颜色3{
字体大小:正常;
}
.col-sm-2{
对齐项目:居中;
证明内容:中心;
显示器:flex;
}
6.
7.
8.
9
5.