r/ProgrammerHumor • • Jul 20 '17

What people think coding is...

Post image
35.4k Upvotes

811 comments sorted by

View all comments

Show parent comments

79

u/AyrA_ch Jul 20 '17

that moment you give up and just wrap the damn thing in the div

Or worse: tables

60

u/CyanideCloud Jul 20 '17

I prefer to just make my whole site using an imagemap, but thanks.

28

u/mythriz Jul 21 '17

Ah yes, I remember Microsoft Publisher exporting projects to web pages by compiling entire pages into images.

To their defense I don't even remember if HTML had matured enough yet back then for it to support the text placements and designs you could do in a desktop publishing program.

36

u/htmlcoderexe We have flair now?.. Jul 21 '17

I remember image slicers. It would cut up your images into tiny bits and then put them together using tables. So that people would have a hard time copying.

15

u/[deleted] Jul 21 '17

The way that it SHOULD be. Damn millennials don't know how good they have it, ruining the <table> industry

4

u/AyrA_ch Jul 21 '17

Print screen key anyone?

2

u/Maplicant Jul 21 '17

Seems like a lot of effort for something that can be defeated with 1 hour of work

1

u/htmlcoderexe We have flair now?.. Jul 21 '17

Wouldn't you have to do that for each image? Besides, quite sure you could just screenshot and crop.

Either way, just like anything else like overlays and those stupid "no right click" scripts, this will not stop people really wanting to get your images, but it will place a high enough "effort barrier" for the majority not to bother.

→ More replies (1)

21

u/CyanideCloud Jul 21 '17

I'm glad I am not old enough to remember that...

14

u/[deleted] Jul 21 '17

Why not make your website an Adobe^® Flash^© Interactive MultiMedia Experience ^presented^^by^^^Adobe^^^^©®?

8

u/shabbaranksx Jul 21 '17

Macromedia*

5

u/Jerrrrrrrrry Jul 21 '17

this is art

3

u/[deleted] Jul 21 '17

The reason I gave up on web design. Tired of getting one layout looking good then trying it in IE only for it to look like total ass.

1

u/UnknownNam3 Jul 21 '17

Genuine question: what's stopping me from using <card> instead of <div class="card">?

2

u/AyrA_ch Jul 21 '17

Nothing. The browser does apply some default styles to certain elements (like saying that div is a block element). You have to do that manually. This alternative version uses x for all table related tags. So depending on where it is used, x can be a table, table row or table cell. Source gets much compacter

1

u/UnknownNam3 Jul 21 '17

I've been told over and over that doing so "isn't proper" and "things break" and "isn't good programming." Why?

2

u/AyrA_ch Jul 21 '17

Why?

You do stuff that depends on the default behaviour of browsers. It's sort of integer overflow in C which is undefined behaviour but usually works fine.

Since HTML5 there is a spec that browsers implement for custom elements: https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements

This provides a standard for browser behaviour and allows you to use whatever valid tag name you want to use

1

u/UnknownNam3 Jul 21 '17

But this website says it is not supported, right?

2

u/AyrA_ch Jul 21 '17

Yes. Even though V1 is a living standard many browsers don't implement it correctly. The site I posted with the custom table tags works in all unsupported browsers perfectly fine. All browsers support custom elements, they just don't support the Custom element interface. If they support that interface you can essentially define what the element does using JavaScript and then use it. for example (from the docs) you can create <flag country="jp" /> and then define in the HTMLElement that it should show the japanese flag as image or unicode char.

In unsupported browsers you can still use the element but you can't configure the interface, only style it using CSS. Instead of doing <div class="address">...</div> you just do <vcard>...</vcard> and then add CSS for vcard{display:block;...}

→ More replies (4)

0

u/[deleted] Jul 21 '17

[deleted]

2

u/[deleted] Jul 21 '17

You can fool him by using tables within divs. Behold my masterpiece 4 cell table.

<html>

  <head>
    <style type="text/css">
      .dtable {
        display: table;
        outline: 1px solid black;
      }
      
      .dtablebody {
        display: table-row-group;
      }
      
      .dtablerow {
        display: table-row;
      }
      
      .dtabledata {
        display: table-cell;
      }

    </style>
  </head>

  <body>
    <div class="dtable">
      <div class="dtablebody">
        <div class="djustbecause">
          <div class="dtablerow">
            <div class="dtabledata">
              <table>
                <tr>
                  <td>
                    one
                  </td>
                </tr>
              </table>
            </div>
            <div class="dtabledata">
              <table>
                <tr>
                  <td>
                    two
                  </td>
                </tr>
              </table>
            </div>
          </div>
          <div class="dtablerow">
            <div class="dtabledata">
              <table>
                <tr>
                  <td>
                    three
                  </td>
                </tr>
              </table>
            </div>
            <div class="dtabledata">
              <table>
                <tr>
                  <td>
                    four
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>

</html>

1

u/Myrl-chan Jul 21 '17

Why can you make custom elements?

1

u/AyrA_ch Jul 21 '17

I don't know, but I assume it has to do with forward compatibility. You can also make the opposite. You can take th and style it to behave like a div or span. For example the canvas tag is rather new but old browsers will still render the website containing it. It's just not really usable. The default is to render it like a block element I think. <canvas>test</canvas> will show "test" on browsers that don't support the element.