* { box-sizing: border-box; } body { margin: 0; padding: 1em; font-family: sans-serif; } .column { display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0 auto; width: 100%; } .search { margin: 20px 0; width: 100%; max-width: 30em; font-size: 1em; } .filters { margin-bottom: 1em; } input[type="number"] { max-width: 3em; } table { border-collapse: collapse; border: 1px solid; margin-top: 1em; } th { border: 1px solid; padding: 0.2em; background: #aaa; } tr { border-collapse: collapse; border: 1px solid #ddd; } td { padding: 0.2em; } th { text-align: left; } .itemname { word-wrap: break-word; word-break: break-all; } .priceinfo { margin-top: 0; } .increase { color: red; } .decrease { color: green; } .hide { display: none; } .cart { display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0 auto; } @media screen and (max-width: 600px) { table { border: 0; } table thead { border: none; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } table tr { display: block; margin-bottom: .625em; } table td { border-bottom: 1px solid #ddd; padding-left: calc(65px + 1.2em); position: relative; display: block; } table td::before { /* * aria-label has no advantage, it won't be read inside a table content: attr(aria-label); */ content: attr(data-label); background-color: #aaa; border: 1px solid; position: absolute; padding: .2em .4em; width: 65px; height: calc(100% - .4em); left: -1px; top: -1px; text-align: right; font-weight: bold; } table td:last-child { border-bottom: 0; } }