Fixing critical issue with Mondrian composition with red, blue and yellow using HTML table

Viewed 38

Can somebody help me with reproduction this painting https://i.stack.imgur.com/84y4I.jpg in browser, with HTML tag and CSS

Yesterday I was seeking help with this task, and one kind gentleman [ user:215552 ] helped me (thank you very much sir!)

But there is still an issue with HTML validator the issue

I tried to fix it in different ways, but finished not knowing how to add cells to this without breaking the whole painting :c

The HTML code (previously edited by the User Heretic Monkey):

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <link rel="stylesheet" href="../css/style.css">
    </head>
    
    <body>
        <table id="table2">
            <colgroup>
                <col class="w69">
                <col class="w65">
                <col class="w65">
                <col class="w71">
                <col class="w71">
                <col class="w76">
                <col class="w76">
                <col class="w52">
            </colgroup>
            <tr class="md">
                <td class="br bb" colspan="3">&nbsp;</td>
                <td class="br bb bl" colspan="2">&nbsp;</td>
                <td class="br bb bl yellow" colspan="2">&nbsp;</td>
                <td class="bb bl">&nbsp;</td>
            </tr>
            <tr class="lg">
                <td class="bt br bb">&nbsp;</td>
                <td class="bt br bb bl red" colspan="4" rowspan="2"></td>
                <td class="bt br bb bl yellow" colspan="2">&nbsp;</td>
                <td></td>
            </tr>
            <tr class="lg">
                <td class="bt br bb" rowspan="2">&nbsp;</td>
                <td class="bt br bb bl">&nbsp;</td>
                <td class="bt br bb bl">&nbsp;</td>
                <td></td>
            </tr>
            <tr class="sm">
                <td class="bt bb bb bl black" colspan="2" rowspan="2"></td>
                <td class="bt bb bl">&nbsp;</td>
                <td class="bt bb">&nbsp;</td>
                <td class="bt bb bl">&nbsp;</td>
                <td class="bt br bb">&nbsp;</td>
                <td></td>
            </tr>
            <tr class="sm">
                <td class="bt br yellow" rowspan="2"></td>
                <td class="bt bl">&nbsp;</td>
                <td class="bt br">&nbsp;</td>
                <td class="bt br bl blue" colspan="2" rowspan="2"></td>
                <td class="bt bl red" rowspan="2"></td>
            </tr>
            <tr class="sm">
                <td class="bt br bl" colspan="2"></td>
                <td class="bt bl black">&nbsp;</td>
                <td class="bt br bl black">&nbsp;</td>
            </tr>
        </table>
    </body>
    
    </html>

The CSS code (previously edited by the User Heretic Monkey):

* {
  box-sizing: border-box;
  background-color: floralwhite;
}

img {
  border: 0px solid transparent;
  width: 404px;
  height: 404px;
}

body {
  width: 100%;
  background-color: floralwhite;
  display: flex;
  justify-content: space-evenly;
}

table {
  empty-cells: show;
  background-color: #fefefe;
  border: 0px solid transparent;
  width: 389px;
  height: 389px;
  margin: 6px;
  border-collapse: collapse;
}
thead { display: none }
tr {
  border: 0px none transparent;
}

td {
  border: 0px none transparent;
}

.bl {
  border-left: var(--border-width, 4px) solid black;
}

.bt {
  border-top: var(--border-width, 4px) solid black;
}

.br {
  border-right: var(--border-width, 4px) solid black;
}

.bb {
  border-bottom: var(--border-width, 4px) solid black;
}

.red {
  background-color: #da422a;
}

.yellow {
  background-color: #f8ce2e;
}

.black {
  background-color: black;
}

.blue {
  background-color: #3c5f99;
}

.sm {
  height: 40px;
}
.md {
  height: 58px;
}
.lg {
  height: 75px;
}

.w69{
  width: 69px;
}
.w65{
  width: 65px;
}

.w71{
  width: 71px;
}

.w76{
  width: 76px;
}

.w52{
  width: 52px;
}
1 Answers

The basic problem s that you have defined 8 columns but there are only 6.

So you end up with some columns having no starting cells as the validator has found (it seems to highlight only the first one it comes across).

In this snippet 6 columns are defined, the redundant CSS and HTML is commented out so it's easier to see what has changed in the basic layout.

Of course this messes up everything else so it was necessary to go through each row redefining the boundaries (col spans) of each rectangle.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="../css/style.css">
  <style>
    * {
      box-sizing: border-box;
      background-color: floralwhite;
    }
    
    img {
      border: 0px solid transparent;
      width: 404px;
      height: 404px;
    }
    
    body {
      width: 100%;
      background-color: floralwhite;
      display: flex;
      justify-content: space-evenly;
    }
    
    table {
      empty-cells: show;
      background-color: #fefefe;
      border: 0px solid transparent;
      width: 389px;
      height: 389px;
      margin: 6px;
      border-collapse: collapse;
    }
    
    thead {
      display: none
    }
    
    tr {
      border: 0px none transparent;
    }
    
    td {
      border: 0px none transparent;
    }
    
    .bl {
      border-left: var(--border-width, 4px) solid black;
    }
    
    .bt {
      border-top: var(--border-width, 4px) solid black;
    }
    
    .br {
      border-right: var(--border-width, 4px) solid black;
    }
    
    .bb {
      border-bottom: var(--border-width, 4px) solid black;
    }
    
    .red {
      background-color: #da422a;
    }
    
    .yellow {
      background-color: #f8ce2e;
    }
    
    .black {
      background-color: black;
    }
    
    .blue {
      background-color: #3c5f99;
    }
    
    .sm {
      height: 40px;
    }
    
    .md {
      height: 58px;
    }
    
    .lg {
      height: 75px;
    }
    
    .w69 {
      width: 69px;
    }
    /*
.w65{
  width: 65px;
}
*/
    
    .w130 {
      width: 130px;
    }
    /*
.w71{
  width: 71px;
}
*/
    
    .w142 {
      width: 142px;
    }
    
    .w76 {
      width: 76px;
    }
    
    .w52 {
      width: 52px;
    }
  </style>
</head>

<body>
  <table id="table2">
    <colgroup>
      <col class="w69">
      <!--<col class="w65">
                <col class="w65">-->
      <col class="w130">
      <!--<col class="w71">
                <col class="w71">-->
      <col class="w142">
      <col class="w76">
      <col class="w76">
      <col class="w52">
    </colgroup>
    <tr class="md">
      <td class="br bb" colspan="2">&nbsp;</td>
      <td class="br bb bl" colspan="1">&nbsp;</td>
      <td class="br bb bl yellow" colspan="2">&nbsp;</td>
      <td class="bb bl">&nbsp;</td>
    </tr>
    <tr class="lg">
      <td class="bt br bb">&nbsp;</td>
      <td class="bt br bb bl red" colspan="2" rowspan="2"></td>
      <td class="bt br bb bl yellow" colspan="2">&nbsp;</td>
      <td></td>
    </tr>
    <tr class="lg">
      <td class="bt br bb" rowspan="2">&nbsp;</td>
      <td class="bt br bb bl">&nbsp;</td>
      <td class="bt br bb bl">&nbsp;</td>
      <td></td>
    </tr>
    <tr class="sm">
      <td class="bt bb bb bl black" colspan="1" rowspan="2"></td>
      <td class="bt bb bl">&nbsp;</td>
      <td class="bt bb bl" colspan="2">&nbsp;</td>
      <td class="bt bb bl">&nbsp;</td>
    </tr>
    <tr class="sm">
      <td class="bt br yellow" rowspan="2"></td>
      <td class="bt bl">&nbsp;</td>
      <td class="bt br bl blue" colspan="2" rowspan="2"></td>
      <td class="bt bl red" rowspan="2"></td>
    </tr>
    <tr class="sm">
      <td class="bt br bl"></td>
      <td class="bt bl black">&nbsp;</td>
    </tr>
  </table>
</body>

</html>

The code now passes W3C validation.

Related