【问题标题】:How to make a grid without using Tables, Flexbox or a Grid-system如何在不使用表格、Flexbox 或网格系统的情况下制作网格
【发布时间】:2018-01-31 09:32:56
【问题描述】:

正如您在标题中看到的,我想在不使用表格、Flexbox 或网格系统的情况下制作网格。但是可以使用浮点数。 它应该看起来像这样(确切的颜色无关紧要):

我一直在寻找类似的主题,但没有找到任何可以帮助我的主题。

我有什么要改变的,它看起来像上面的图片? 这是我当前的代码:

/* ########################################################################## */
/* Global Settings */
/* ########################################################################## */

html, body{
  width: 100%;
  height:100%;
  font-family: Arial, sans-serif;
  font-size: 16px;
}

*{
  margin: 0;
  padding: 0;
  list-style: none;
  box-sizing: border-box;
}

/* ########################################################################## */
/* Clearfix-Hack */
/* ########################################################################## */

.clearfix::after{
	content:"";
	clear:both;
	display: block;
}

/* ########################################################################## */
/* Entire Page */
/* ########################################################################## */

.entire-page{
  margin: 0 15%;
}


/* ########################################################################## */
/* Square/Rectangle */
/*  ########################################################################## */

.square,
.div{
  width: calc((100% - 60px) / 3);
  float: left;
}

.div{
  height:422px;
}

.rectangle {
  width: calc((100% - 60px) / 3 * 2 + 30px);
  float: left;
}

.row{
  margin-bottom: 30px;
}

.row .square:nth-of-type(1) {
 margin-right: 30px;
}

.row .square:nth-of-type(3) {
 margin-left: 30px;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title></title>
  <link rel="stylesheet" type="text/css" href="src/css/styles4.css">
</head>

<body>

  <!-- ########################################################################## -->
  <!-- Entire Page -->
  <!-- ########################################################################## -->
  <div class="entire-page">

        <!-- ########################################################################## -->
        <!-- Square/Rectangle  -->
        <!--  ########################################################################## -->

        <section>
            <div>

              <div class="row row-1">
                <div class="square pic1"><img src="https://www1.xup.in/exec/ximg.php?fid=56589964"></div>
                <div class="square pic1"><img src="https://www1.xup.in/exec/ximg.php?fid=56589964"></div>
                <div class="square div"></div>
              </div>

              <div class="row row-2">
                <div class="rectangle pic2"><img src="https://www1.xup.in/exec/ximg.php?fid=19960346"></div>
                <div class="square div"></div>
              </div>

            </div>
        </section>

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

【问题讨论】:

    标签: html css css-float css-position


    【解决方案1】:

    您可以使用 .有 2 行 - 即 &lt;tr&gt;'s。第一行有 3 列 - 即 &lt;td&gt;'s. 第二行只有 2 个 &lt;td&gt;'s,而该行的第一行的 colspan=2。

    阅读有关表格的更多信息here

    根据需要应用样式。

    【讨论】:

    • 不应使用表格。
    • ...现在也编辑了标题以拒绝表格。
    猜你喜欢
    • 2021-11-10
    • 2019-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-23
    • 1970-01-01
    • 2018-05-04
    • 2019-09-08
    相关资源
    最近更新 更多