在块内添加文本

时间:2019-08-01 19:47:17

标签: html css

我创建了html / css文件,其中的背景带有渐变,三列带有块, 但文本不会显示在块内。 可能是什么问题呢? 我知道该文本已添加到div标签内,但这不能解决我的问题。

.container {
  width: 800px;
  height: 600px;
  min-height: 150px;
  margin: 50px auto;
  padding: 50px;
  box-shadow: 0 0 2px #cccccc;
  background: linear-gradient(135deg, #FBFBFB, #EAC78F, #CCA263, #B88D4E);
}

.wrap {
  font-size: 0;
  width: 800px;
  margin: 0 auto;
  padding: 20px 0;
  color: black;
}

.column {
  margin-right: 5%;
  height: 250px;
  width: 30%;
  display: inline-block;
  vertical-align: top;
}

.column .column-item {
  height: 185px;
  background: #FBFBFB;
  border-radius: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.column:last-child {
  margin-right: 0;
}
<!DOCTYPE HTML>
<html>

<head>
  <meta charset="utf-8">
  <title>Furniture APP Component by Blue for VisualMaka</title>
  <style type="text/css"></style>
  <link rel="stylesheet" type="text/css" href="итог.css">
</head>

<body>
  <div class="wrap">
    <div class="container">
      <div class="column">
        <div class="column-item">block1</div>
        <div class="column-item">block2</div>
        <div class="column-item">block3</div>
      </div>
      <div class="column">
        <div class="column-item">block4</div>
        <div class="column-item">block5</div>
        <div class="column-item">block6</div>
      </div>
      <div class="column">
        <div class="column-item">block7</div>
        <div class="column-item">block8</div>
      </div>

    </div>
  </div>
</body>

</html>

所有项目均按我的计划显示。但是该文本不起作用。

1 个答案:

答案 0 :(得分:0)

具有类div的包装器.wrapfont-size属性设置为绝对0。提供有效的font-size值,您的文本会再次出现:

.container {
  width: 800px;
  height: 600px;
  min-height: 150px;
  margin: 50px auto;
  padding: 50px;
  box-shadow: 0 0 2px #cccccc;
  background: linear-gradient(135deg, #FBFBFB, #EAC78F, #CCA263, #B88D4E);
}

.wrap {
  font-size: 10px;
  width: 800px;
  margin: 0 auto;
  padding: 20px 0;
  color: black;
}

.column {
  margin-right: 5%;
  height: 250px;
  width: 30%;
  display: inline-block;
  vertical-align: top;
}

.column .column-item {
  height: 185px;
  background: #FBFBFB;
  border-radius: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.column:last-child {
  margin-right: 0;
}
<!DOCTYPE HTML>
<html>

<head>
  <meta charset="utf-8">
  <title>Furniture APP Component by Blue for VisualMaka</title>
  <style type="text/css"></style>
  <link rel="stylesheet" type="text/css" href="итог.css">
</head>

<body>
  <div class="wrap">
    <div class="container">
      <div class="column">
        <div class="column-item">block1</div>
        <div class="column-item">block2</div>
        <div class="column-item">block3</div>
      </div>
      <div class="column">
        <div class="column-item">block4</div>
        <div class="column-item">block5</div>
        <div class="column-item">block6</div>
      </div>
      <div class="column">
        <div class="column-item">block7</div>
        <div class="column-item">block8</div>
      </div>

    </div>
  </div>
</body>

</html>