Is it possible to align the following div's to be always on same position width and height on any webpage? I have try anything but I cannot manage to get it working. Something is not compatible in my code.
.content-box-gray .content {
overflow: hidden;
padding: 10px;
font-size: 15px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border: 1px solid gray;
color: #3385FF;
}
.content-box-gray .title {
height: 30px;
line-height: 30px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
background: gray;
font-size: 18px;
font-weight: bold;
font-family: verdana;
display: block;
color: white;
display: block;
padding: 10px;
border: 1px solid gray;
border-bottom: none;
}
<table width="100%" height="100%" border="0" cellspacing="5" cellpadding="5">
<tbody>
<tr>
<td colspan="2" rowspan="3">
<div class="content-box-orange">
<div class="titleorange">3</div>
<div class="content">Lorem Ipsum is simply dummy text</div>
</div>
</td>
</tr>
<tr style="height:100% ">
<td style="background-color: aqua;height: 50%">1</td>
</tr>
<tr>
<td style="background-color: aqua;height: 50%">2</td>
</tr>
<tr>
<td colspan="3" style="background-color: #FFF">4</td>
</tr>
<tr>
<td style="background-color: #FFF">5</td>
<td colspan="2" rowspan="2">
<div class="content-box-gray">
<div class="title">7</div>
<div class="content">Lorem Ipsum</div>
</div>
</td>
</tr>
<tr>
<td style="background-color: #FFF">6</td>
</tr>
</tbody>
</table>
jsfiddle
I cannot manage to fix it.
here is a pic alignment of divs
thank you very much!
Give the td a height of 100%. Then use the calc property to set the height of .content-box-orange .content
fiddle
I think that you could explore flexbox instead of table for this layout. Update your question if you are open to that...
html,
body {
height: 98%;
background-color: #E5E5E3
}
table tbody tr td {
height: 100%;
}
.content-box-gray .content {
overflow: hidden;
padding: 10px;
font-size: 15px;
border: 0px;
color: #3385FF;
background: #FFFFFF;
}
.content-box-gray .title {
height: 30px;
line-height: 30px;
background: #F1F1F1;
font-size: 18px;
font-weight: bold;
font-family: verdana;
display: block;
color: #464648;
display: block;
padding: 10px;
border: 0px;
border-bottom: none;
}
.content-box-orange {
height: 100%;
}
.content-box-orange .content {
overflow: hidden;
padding: 10px;
font-size: 15px;
border: 0px;
color: #000;
background: #FFFFFF;
height: calc(100% - 66px);
}
.titleorange {
height: 30px;
line-height: 30px;
background: #F78D27;
font-size: 18px;
font-weight: bold;
font-family: verdana;
display: block;
color: #FFF;
display: block;
padding: 10px;
border: 0px;
border-bottom: none;
}
<table width="100%" height="100%" border="0" cellspacing="5" cellpadding="5">
<tbody>
<tr>
<td colspan="2" rowspan="3">
<div class="content-box-orange">
<div class="titleorange">3</div>
<div class="content">Lorem Ipsum is simply dummy text</div>
</div>
</td>
</tr>
<tr style="height:100% ">
<td style="background-color: aqua;height: 50%">1</td>
</tr>
<tr>
<td style="background-color: aqua;height: 50%">2</td>
</tr>
<tr>
<td colspan="3" style="background-color: #FFF">4</td>
</tr>
<tr>
<td style="background-color: #FFF">5</td>
<td colspan="2" rowspan="2">
<div class="content-box-gray">
<div class="title">7</div>
<div class="content">Lorem Ipsum</div>
</div>
</td>
</tr>
<tr>
<td style="background-color: #FFF">6</td>
</tr>
</tbody>
</table>
Using Flexbox
Here is a rough guide to achieving the layout in your image using flexbox. Refer to caniuse for browser compatibility information. You can toggle properties in Chrome Dev tools to get an idea of how flexbox properties work if it's new to you.
fiddle
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
html {
height: 100%;
}
body {
background: #FFF;
font-family: sans-serif;
height: 100%;
margin: 0;
padding: 5px;
}
.box,
.main {
border: 5px solid #43c2eb;
}
.title--orange {
background: orange;
text-align: center;
padding: .4em;
margin: 0;
}
.wrapper {
display: flex;
flex-direction: column;
height: 100%;
}
.row {
display: flex;
min-height: 200px;
flex: 1 1 auto;
}
.box-wrap {
flex: 1 1 auto;
display: flex;
flex-direction: column;
}
.box {
margin: 5px;
display: flex;
flex-direction: column;
}
.box--big {
flex: 2 1 auto;
}
.box--small {
flex: 1 1 auto;
}
.main {
align-items: center;
justify-content: center;
margin: 5px;
}
.content {
flex-grow: 1;
display: flex;
justify-content: center;
align-items: center;
font-size: 22px;
}
<div class="wrapper">
<div class="row upper">
<div class="box box--big">
<h1 class="title--orange">div header</h1>
<div class="content">
content
</div>
</div>
<div class="box-wrap">
<div class="box box--small">
<div class="content">content</div>
<h2 class="title--orange">div header</h2>
</div>
<div class="box box--small">
<div class="content">content</div>
<h2 class="title--orange">div header</h2>
</div>
</div>
</div>
<div class="row main">
<div class="main__inner">content</div>
</div>
<div class="row lower">
<div class="box-wrap">
<div class="box box--small">
<div class="content">content</div>
</div>
<div class="box box--small">
<div class="content">content</div>
</div>
</div>
<div class="box box--big">
<h1 class="title--orange">div header</h1>
<div class="content">
content
</div>
</div>
</div>
</div>
Remove style attributes and width,height attributes on your HTML code, no need it if you use CSS.
Also dont use % on Width y if you want a static table.
<table width="100%" height="100%" border="0" cellspacing="5" cellpadding="5">
<tr style="height:100% ">
<td style="background-color: aqua;height: 50%">1</td>
Give style="height:100%;overflow:hidden;" to outer div and style="height:100%;" to content & td
html,
body {
height: 98%;
background-color: #E5E5E3
}
.content-box-gray .content {
overflow: hidden;
padding: 10px;
font-size: 15px;
border: 0px;
color: #3385FF;
background: #FFFFFF;
}
.content-box-gray .title {
height: 30px;
line-height: 30px;
background: #F1F1F1;
font-size: 18px;
font-weight: bold;
font-family: verdana;
display: block;
color: #464648;
display: block;
padding: 10px;
border: 0px;
border-bottom: none;
}
.content-box-orange .content {
overflow: hidden;
padding: 10px;
font-size: 15px;
border: 0px;
color: #000;
background: #FFFFFF;
}
.titleorange {
height: 30px;
line-height: 30px;
background: #F78D27;
font-size: 18px;
font-weight: bold;
font-family: verdana;
display: block;
color: #FFF;
display: block;
padding: 10px;
border: 0px;
border-bottom: none;
}
<table border="0" cellspacing="5" cellpadding="5">
<tbody>
<tr>
<td colspan="2" rowspan="3" style="height:100%;">
<div class="content-box-orange" style="height:100%;overflow:hidden;">
<div class="titleorange">3</div>
<div class="content" style="height:100%;">Lorem Ipsum is simply dummy text</div>
</div>
</td>
</tr>
<tr>
<td style="background-color: aqua;height: 50px">1</td>
</tr>
<tr>
<td style="background-color: aqua;height: 50px">2</td>
</tr>
<tr>
<td colspan="3" style="background-color: #FFF">4</td>
</tr>
<tr>
<td style="background-color: #FFF">5</td>
<td colspan="2" rowspan="2" style="height:100%;">
<div class="content-box-gray" style="height:100%;overflow:hidden;">
<div class="title">7</div>
<div class="content" style="height:100%;">Lorem Ipsum</div>
</div>
</td>
</tr>
<tr>
<td style="background-color: #FFF">6</td>
</tr>
</tbody>
</table>
Related
I tried everything I could to set a distance from navbar and dashboard from menu but I have no idea how to make it work :). I'm still very new in this programming.
Also every time I click the menu-button, yes it works but the navbar moves weirdly and wasn't maximized.
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
list-style-type: none;
text-decoration: none;
font-family: 'Poppins', sans-serif;
}
#menu {
width: 345px;
position: fixed;
left: 0;
top: 0;
height: 100%;
background-color: #1e1e1e;
z-index: 100;
transition: width 300ms;
}
#logo {
height: 90px;
padding: 32px 0px 16px 20px;
color: #fff;
}
#logo a {
text-decoration: none;
color: #fff;
}
#logo h2 {
margin-top: -49px;
padding-left: 50px;
}
#menubar li {
width: 100%;
margin-bottom: 27px;
padding-left: 16px;
padding-right: 16px;
}
#menubar a {
padding-left: 16px;
display: block;
color: #a9a9a9;
font-size: 14pt;
}
#menubar a#home {
margin-top: 50px;
color: #a9a9a9;
}
#menubar a:hover {
color: #fff;
transition: 0.5s;
}
#menubar a span:first-child {
font-size: 18pt;
padding-right: 16px;
}
#nav-toggle:checked+#menu {
width: 90px;
}
#nav-toggle:checked+#menu #logo h2,
#nav-toggle:checked+#menu li a {
padding-left: 16px;
}
#nav-toggle:checked+#menu #logo h2,
#nav-toggle:checked+#menu li a span:last-child {
display: none;
}
#navbar {
transition: margin-left 300ms;
margin-left: 345px;
}
#nav-toggle:checked~#navbar {
margin-left: 90px;
}
#nav-toggle:checked~#navbar header {
width: calc(100% - 70px);
}
header {
display: flex;
justify-content: space-between;
padding: 16px;
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
position: fixed;
width: calc(100% - 345px);
background-color: #fff;
transition: left 300ms;
}
.dashboard-title {
display: flex;
margin-top: -39px;
margin-left: 50px;
}
#nav-toggle {
display: none;
}
.menu-button {
margin-top: 10px;
}
#search {
border: 1px solid #ccc;
border-radius: 15px;
height: 50px;
display: flex;
align-items: center;
overflow-x: hidden;
}
#search span {
display: inline-block;
padding: 0px 16px;
font-size: 16pt;
}
#search input {
height: 100%;
padding: 8px;
border: none;
outline: none;
}
#user {
display: flex;
align-items: center;
margin-right: 10px;
}
main {
padding: 32px 24px;
min-height: calc(100vh - 0px);
background-color: #f1f5f9;
}
#dashboard {
margin-left: 345px;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 32px;
margin-top: 100px;
}
#box {
display: flex;
justify-content: space-between;
background: #fff;
padding: 32px;
border-radius: 10px;
}
#box span {
margin-top: 50px;
margin-left: -110px;
color: #a9a9a9;
}
#box .customer {
float: left;
margin-left: -115px;
}
#box .box-sign {
color: #a9a9a9;
}
#dashboard-second {
margin-left: 345px;
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 32px;
margin-top: 32px;
}
#box-second {
display: flex;
justify-content: space-between;
background: #fff;
padding: 32px;
border-radius: 10px;
}
#box-second h2 {
font-size: 14pt;
margin-right: 300px;
}
#box-second .kalendar {
margin-right: 370px;
}
.tabel {
margin-left: 345px;
margin-top: 150px;
padding: 30px 40px 40px 30px;
border-radius: 10px;
background-color: #fff;
}
table,
th,
td {
border-collapse: collapse;
height: 50px;
}
thead {
box-shadow: 0px 3px rgba(0, 0, 0, 0.1);
}
table {
width: 100%;
}
table tr {
border-bottom: 1px solid #a9a9a9;
}
table th {
text-align: left;
padding-left: 10px;
}
.table-spacing {
padding-left: 10px;
}
table button {
background-color: #24a0ed;
color: #fff;
font-weight: bold;
padding: 7px 20px 7px 20px;
border-radius: 5px;
display: block;
margin: auto;
border: 0;
cursor: pointer;
}
.transaksi-icon {
padding-left: 10px;
}
.tabel-customer {
margin-left: 400px;
padding-top: 200px;
padding-right: 40px;
}
.customer-icon {
padding-left: 10px;
}
.laporan-icon {
padding-left: 10px;
}
.tabel-laporan {
margin-left: 400px;
padding-top: 200px;
padding-right: 40px;
}
#dashboard-third {
margin-left: 345px;
padding-top: 70px;
padding-bottom: 20px;
padding-right: 25px;
padding-left: 25px;
background-color: #fff;
margin-top: 35px;
border-radius: 10px;
}
#box-third {
margin-top: -50px;
}
#box-third h2 {
margin-top: -32px;
padding-left: 30px;
font-size: 14pt;
}
#media only screen and (max-width: 1200px) {
#menu {
width: 90px;
}
#menu #logo h2,
#menu li a {
padding-left: 16px;
}
#menu #logo h2,
#menu li a span:last-child {
display: none;
}
#navbar {
margin-left: 90px;
}
#navbar header {
width: calc(100% - 70px);
}
}
#media only screen and (max-width: 960px) {
#dashboard {
grid-template-columns: repeat(3, 1fr);
}
}
<div id="all">
<input type="checkbox" id="nav-toggle">
<div id="menu">
<div id="logo">
<a href="index.html">
<iconify-icon icon="ic:outline-local-laundry-service" width="50"></iconify-icon>
<h2>Low'n Dry</h2>
</a>
</div>
<div id="menubar">
<ul>
<li>
<a href="index.html" class="home"><span><iconify-icon icon="ant-design:home-outlined"></iconify-icon></span>
<span>Dashboard</span>
</a>
</li>
<li>
<a href="#" class="manajemen"><span><iconify-icon icon="ant-design:user-outlined"></iconify-icon></span>
<span>Manajemen User</span>
</a>
</li>
<li>
<a href="transaksi.html" class="transaksi"><span><iconify-icon icon="ep:money"></iconify-icon></span>
<span>Transaksi</span>
</a>
</li>
<li>
<a href="#" class="paket"><span><iconify-icon icon="grommet-icons:package"></iconify-icon></span>
<span>Paket Laundry</span>
</a>
</li>
<li>
<a href="customer.html" class="customer"><span><iconify-icon icon="ic:outline-people"></iconify-icon></span>
<span>Customer</span>
</a>
</li>
<li>
<a href="laporan.html" class="laporan"><span><iconify-icon icon="carbon:report" ></iconify-icon></span>
<span>Laporan</span>
</a>
</li>
</ul>
</div>
</div>
<div id="navbar">
<header>
<label for="nav-toggle">
<iconify-icon icon="ant-design:menu-outlined" class="menu-button" width="43" height="29"></iconify-icon>
<h2 class="dashboard-title">Dashboard</h2>
</label>
<div id="search">
<span class="search-button"><iconify-icon icon="codicon:search"></iconify-icon></span>
<input type="search" placeholder="Search" />
</div>
<div id="user">
<div>
<h4>Admin</h4>
</div>
</div>
</header>
</div>
<main>
<div id="dashboard">
<div id="box">
<h1>23</h1>
<span class="customer">Customer</span>
<iconify-icon icon="ic:outline-people" class="box-sign" width="40px"></iconify-icon>
</div>
<div id="box">
<h1>21</h1>
<span>Karyawan</span>
<iconify-icon icon="ic:outline-people" class="box-sign" width="40px"></iconify-icon>
</div>
<div id="box">
<h1>21</h1>
<span>New Order</span>
<iconify-icon icon="ant-design:shopping-cart-outlined" class="box-sign" width="40px"></iconify-icon>
</div>
<div id="box">
<h1>29</h1>
<span>Total Order</span>
<iconify-icon icon="ant-design:shopping-cart-outlined" class="box-sign" width="40px"></iconify-icon>
</div>
</div>
<div id="dashboard-second">
<div id="box-second">
<iconify-icon icon="bi:bar-chart" width="25px" class="box-sign-second"></iconify-icon>
<h2>Grafik Penjualan</h2>
</div>
<div id="box-second">
<iconify-icon icon="ant-design:calendar-outlined" width="25px" class="box-sign-second"></iconify-icon>
<h2 class="kalendar">Kalender</h2>
</div>
</div>
<div id="dashboard-third">
<div id="box-third">
<iconify-icon icon="ant-design:clock-circle-outlined" width="25px" class="order-icon"></iconify-icon>
<h2>Order Terbaru</h2>
</div>
<table class="order-tabel">
<thead>
<tr>
<th>No.</th>
<th>Tgl. Transaksi</th>
<th>Customer</th>
<th>Paket</th>
<th>Pembayaran</th>
<th>Status Order</th>
<th>Total</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<tr>
<td class="table-spacing">1. </td>
<td class="table-spacing">01/10/2022</td>
<td class="table-spacing">Budi</td>
<td class="table-spacing">Paket A</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing" style="color: rgb(50, 233, 108)">Diambil</td>
<td class="table-spacing">Rp 60.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">2. </td>
<td class="table-spacing">05/10/2022</td>
<td class="table-spacing">Dibu</td>
<td class="table-spacing">Paket B</td>
<td class="table-spacing" style="color:rgb(50, 233, 108)">Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 240.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">3. </td>
<td class="table-spacing">11/10/2022</td>
<td class="table-spacing">Ubid</td>
<td class="table-spacing">Paket A</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 85.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">4. </td>
<td class="table-spacing">14/10/2022</td>
<td class="table-spacing">Ibud</td>
<td class="table-spacing">Paket C</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 72.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">5. </td>
<td class="table-spacing">18/10/2022</td>
<td class="table-spacing">Bidu</td>
<td class="table-spacing">Paket C</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 60.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">6. </td>
<td class="table-spacing">20/10/2022</td>
<td class="table-spacing">Udib</td>
<td class="table-spacing">Paket B</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 240.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">7. </td>
<td class="table-spacing">28/10/2022</td>
<td class="table-spacing">Dubi</td>
<td class="table-spacing">Paket B</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 85.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>No.</th>
<th>Tgl. Transaksi</th>
<th>Customer</th>
<th>Paket</th>
<th>Pembayaran</th>
<th>Status Order</th>
<th>Total</th>
<th>Aksi</th>
</tr>
</tfoot>
</table>
</div>
</div>
</main>
</div>
</body>
You've got your header as position:fixed which means it's got no height and the content overflows it. If you remove that then set the header to 100% it'll work.
For the main element, add the margin to that and not it's children then all you need to do is change margin-left for that for the css #nav-toggle:checked rules
Finally you've hard coded the widths when the menu is toggled, if you use CSS variables then you only need to change one value.
I've also altered your logo and logo text to show you how to align the icon and text a bit neater. You can use that example for the rest of your items and the stuff in the main element. All markup changes are highlighted.
body {
--width-wide-menu: 345px;
--width-narrow-menu: 90px;
}
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
list-style-type: none;
text-decoration: none;
font-family: 'Poppins', sans-serif;
}
#menu {
width: 345px;
position: fixed;
left: 0;
top: 0;
height: 100%;
background-color: #1e1e1e;
z-index: 100;
transition: width 300ms;
}
#logo {
/* height: 90px; */
display: flex;
/* added this */
align-items: center;
padding: 32px 0px 16px 20px;
color: #fff;
}
#logo a {
text-decoration: none;
color: #fff;
}
#logo h2 {
margin-top: 0;
display: flex;
height: 100%;
justify-content: center;
/* padding-left: 50px; */
}
#menubar li {
width: 100%;
margin-bottom: 27px;
padding-left: 16px;
padding-right: 16px;
}
#menubar a {
padding-left: 16px;
display: block;
color: #a9a9a9;
font-size: 14pt;
}
#menubar a#home {
margin-top: 50px;
color: #a9a9a9;
}
#menubar a:hover {
color: #fff;
transition: 0.5s;
}
#menubar a span:first-child {
font-size: 18pt;
padding-right: 16px;
}
#nav-toggle:checked+#menu {
width: 90px;
}
#nav-toggle:checked+#menu #logo h2,
#nav-toggle:checked+#menu li a {
padding-left: 16px;
}
#nav-toggle:checked+#menu #logo h2,
#nav-toggle:checked+#menu li a span:last-child {
display: none;
}
#navbar {
transition: margin-left 300ms;
margin-left: var(--width-wide-menu);
}
#nav-toggle:checked~#navbar {
margin-left: 90px;
}
#nav-toggle:checked~main {
margin-left: 90px;
}
#nav-toggle:checked~#navbar header {
/* width: calc(100% - 70px); */
}
header {
display: flex;
justify-content: space-between;
padding: 16px;
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
/* position: fixed; */
/* width: calc(100% - 345px); */
width: 100%;
/* Added this */
background-color: #fff;
transition: left 300ms;
}
.dashboard-title {
display: flex;
margin-top: -39px;
margin-left: 50px;
}
#nav-toggle {
display: none;
}
.menu-button {
margin-top: 10px;
}
#search {
border: 1px solid #ccc;
border-radius: 15px;
height: 50px;
display: flex;
align-items: center;
overflow-x: hidden;
}
#search span {
display: inline-block;
padding: 0px 16px;
font-size: 16pt;
}
#search input {
height: 100%;
padding: 8px;
border: none;
outline: none;
}
#user {
display: flex;
align-items: center;
margin-right: 10px;
}
main {
padding: 32px 24px;
min-height: calc(100vh - 0px);
background-color: #f1f5f9;
margin-left: var(--width-wide-menu);
/* added this */
}
#dashboard {
/* margin-left: 345px; */
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 32px;
margin-top: 100px;
}
#box {
display: flex;
justify-content: space-between;
background: #fff;
padding: 32px;
border-radius: 10px;
}
#box span {
margin-top: 50px;
margin-left: -110px;
color: #a9a9a9;
}
#box .customer {
float: left;
margin-left: -115px;
}
#box .box-sign {
color: #a9a9a9;
}
#dashboard-second {
/* margin-left: 345px; */
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 32px;
margin-top: 32px;
}
#box-second {
display: flex;
justify-content: space-between;
background: #fff;
padding: 32px;
border-radius: 10px;
}
#box-second h2 {
font-size: 14pt;
margin-right: 300px;
}
#box-second .kalendar {
margin-right: 370px;
}
.tabel {
/* margin-left: 345px; */
margin-top: 150px;
padding: 30px 40px 40px 30px;
border-radius: 10px;
background-color: #fff;
}
table,
th,
td {
border-collapse: collapse;
height: 50px;
}
thead {
box-shadow: 0px 3px rgba(0, 0, 0, 0.1);
}
table {
width: 100%;
}
table tr {
border-bottom: 1px solid #a9a9a9;
}
table th {
text-align: left;
padding-left: 10px;
}
.table-spacing {
padding-left: 10px;
}
table button {
background-color: #24a0ed;
color: #fff;
font-weight: bold;
padding: 7px 20px 7px 20px;
border-radius: 5px;
display: block;
margin: auto;
border: 0;
cursor: pointer;
}
.transaksi-icon {
padding-left: 10px;
}
.tabel-customer {
margin-left: 400px;
padding-top: 200px;
padding-right: 40px;
}
.customer-icon {
padding-left: 10px;
}
.laporan-icon {
padding-left: 10px;
}
.tabel-laporan {
margin-left: 400px;
padding-top: 200px;
padding-right: 40px;
}
#dashboard-third {
/* margin-left: 345px; */
padding-top: 70px;
padding-bottom: 20px;
padding-right: 25px;
padding-left: 25px;
background-color: #fff;
margin-top: 35px;
border-radius: 10px;
}
#box-third {
margin-top: -50px;
}
#box-third h2 {
margin-top: -32px;
padding-left: 30px;
font-size: 14pt;
}
#media only screen and (max-width: 1200px) {
#menu {
width: var(--width-narrow-menu);
}
#menu #logo h2,
#menu li a {
padding-left: 16px;
}
#menu #logo h2,
#menu li a span:last-child {
display: none;
}
#navbar {
margin-left: var(--width-narrow-menu);
width: 100%;
/*Added this */
}
main {
margin-left: var(--width-narrow-menu);
/* added this */
}
#navbar header {
width: calc(100% - 70px);
}
}
#media only screen and (max-width: 960px) {
#dashboard {
grid-template-columns: repeat(3, 1fr);
}
}
<script src="https://code.iconify.design/iconify-icon/1.0.1/iconify-icon.min.js"></script>
<div id="all">
<input type="checkbox" id="nav-toggle">
<div id="menu">
<div id="logo">
<!-- <a href="index.html"> -->
<iconify-icon icon="ic:outline-local-laundry-service" width="50"></iconify-icon>
<h2>Low'n Dry</h2>
<!-- </a> -->
</div>
<div id="menubar">
<ul>
<li>
<a href="index.html" class="home"><span>
<iconify-icon icon="ant-design:home-outlined"></iconify-icon>
</span>
<span>Dashboard</span>
</a>
</li>
<li>
<a href="#" class="manajemen"><span>
<iconify-icon icon="ant-design:user-outlined"></iconify-icon>
</span>
<span>Manajemen User</span>
</a>
</li>
<li>
<a href="transaksi.html" class="transaksi"><span>
<iconify-icon icon="ep:money"></iconify-icon>
</span>
<span>Transaksi</span>
</a>
</li>
<li>
<a href="#" class="paket"><span>
<iconify-icon icon="grommet-icons:package"></iconify-icon>
</span>
<span>Paket Laundry</span>
</a>
</li>
<li>
<a href="customer.html" class="customer"><span>
<iconify-icon icon="ic:outline-people"></iconify-icon>
</span>
<span>Customer</span>
</a>
</li>
<li>
<a href="laporan.html" class="laporan"><span>
<iconify-icon icon="carbon:report"></iconify-icon>
</span>
<span>Laporan</span>
</a>
</li>
</ul>
</div>
</div>
<div id="navbar">
<header>
<label for="nav-toggle">
<iconify-icon icon="ant-design:menu-outlined" class="menu-button" width="43" height="29"></iconify-icon>
<h2 class="dashboard-title">Dashboard</h2>
</label>
<div id="search">
<span class="search-button">
<iconify-icon icon="codicon:search"></iconify-icon>
</span>
<input type="search" placeholder="Search" />
</div>
<div id="user">
<div>
<h4>Admin</h4>
</div>
</div>
</header>
</div>
<main>
<div id="dashboard">
<div id="box">
<h1>23</h1>
<span class="customer">Customer</span>
<iconify-icon icon="ic:outline-people" class="box-sign" width="40px"></iconify-icon>
</div>
<div id="box">
<h1>21</h1>
<span>Karyawan</span>
<iconify-icon icon="ic:outline-people" class="box-sign" width="40px"></iconify-icon>
</div>
<div id="box">
<h1>21</h1>
<span>New Order</span>
<iconify-icon icon="ant-design:shopping-cart-outlined" class="box-sign" width="40px"></iconify-icon>
</div>
<div id="box">
<h1>29</h1>
<span>Total Order</span>
<iconify-icon icon="ant-design:shopping-cart-outlined" class="box-sign" width="40px"></iconify-icon>
</div>
</div>
<div id="dashboard-second">
<div id="box-second">
<iconify-icon icon="bi:bar-chart" width="25px" class="box-sign-second"></iconify-icon>
<h2>Grafik Penjualan</h2>
</div>
<div id="box-second">
<iconify-icon icon="ant-design:calendar-outlined" width="25px" class="box-sign-second"></iconify-icon>
<h2 class="kalendar">Kalender</h2>
</div>
</div>
<div id="dashboard-third">
<div id="box-third">
<iconify-icon icon="ant-design:clock-circle-outlined" width="25px" class="order-icon"></iconify-icon>
<h2>Order Terbaru</h2>
</div>
<table class="order-tabel">
<thead>
<tr>
<th>No.</th>
<th>Tgl. Transaksi</th>
<th>Customer</th>
<th>Paket</th>
<th>Pembayaran</th>
<th>Status Order</th>
<th>Total</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<tr>
<td class="table-spacing">1. </td>
<td class="table-spacing">01/10/2022</td>
<td class="table-spacing">Budi</td>
<td class="table-spacing">Paket A</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing" style="color: rgb(50, 233, 108)">Diambil</td>
<td class="table-spacing">Rp 60.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">2. </td>
<td class="table-spacing">05/10/2022</td>
<td class="table-spacing">Dibu</td>
<td class="table-spacing">Paket B</td>
<td class="table-spacing" style="color:rgb(50, 233, 108)">Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 240.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">3. </td>
<td class="table-spacing">11/10/2022</td>
<td class="table-spacing">Ubid</td>
<td class="table-spacing">Paket A</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 85.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">4. </td>
<td class="table-spacing">14/10/2022</td>
<td class="table-spacing">Ibud</td>
<td class="table-spacing">Paket C</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 72.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">5. </td>
<td class="table-spacing">18/10/2022</td>
<td class="table-spacing">Bidu</td>
<td class="table-spacing">Paket C</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 60.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">6. </td>
<td class="table-spacing">20/10/2022</td>
<td class="table-spacing">Udib</td>
<td class="table-spacing">Paket B</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 240.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
<tr>
<td class="table-spacing">7. </td>
<td class="table-spacing">28/10/2022</td>
<td class="table-spacing">Dubi</td>
<td class="table-spacing">Paket B</td>
<td class="table-spacing">Belum Lunas</td>
<td class="table-spacing">Baru</td>
<td class="table-spacing">Rp 85.000</td>
<td>
<button type="button">Detail</button>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>No.</th>
<th>Tgl. Transaksi</th>
<th>Customer</th>
<th>Paket</th>
<th>Pembayaran</th>
<th>Status Order</th>
<th>Total</th>
<th>Aksi</th>
</tr>
</tfoot>
</table>
</div>
</main>
</div>
I would like to draw the following in my web page:
where the three buttons are submit buttons.
I managed to do most but having a problem drawing the vertical lines.
here is my code:
th,
td {
padding: 10px;
}
table.center {
margin-left: auto;
margin-right: auto;
border-collapse: separate;
border-spacing: 50px 0;
}
span {
border-bottom: 2px solid gray;
border-right: 2px solid gray;
padding: 2px;
display: inline-block;
width: 100%;
}
.button {
width: 100%;
padding: 10px;
font: bold;
font-size: 20px;
border: none;
}
.button_blue {
background-color: LightSkyBlue;
}
.button_red {
background-color: OrangeRed;
}
.button_yellow {
background-color: yellow;
}
.boxed {
width: 600px;
border: 3px solid green;
padding: 5px;
margin: 5px;
margin-left: auto;
margin-right: auto;
}
.circle {
width: 40px;
height: 40px;
line-height: 40px;
border-radius: 50%;
border: none;
font-size: 30px;
font: bold;
text-align: center;
display: inline-block;
;
}
<div style="text-align:center">
<u style="color:Red;">
<h1 style="color:DodgerBlue;font-size:3em;">
Hashi
</h1>
</u>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<p></p>
<div style="text-align:center">
<p></p>
<table class="center">
<tr>
<td></td>
<td style="border-bottom:4px solid black"></td>
</tr>
<tr>
<td style="text-align:center"><text style="color:DodgerBlue;font-size: 2em;"> Build bridges </text></td>
<td>
<span> {{ form.create(class_="button button_blue") }} </span>
</td>
</tr>
<tr>
<td style="text-decoration: line-through; text-decoration-thickness:5px;">
<div class="circle" style="background-color:yellow;">
3
</div>
<div class="circle" style="background-color:OrangeRed;">
2
</div>
<div class="circle" style="background-color:lightgreen;">
5
</div>
</td>
<td>
<span>{{ form.load(class_="button button_red") }}</span>
</td>
</tr>
<tr>
<td>
<div class="circle" style="background-color:blue;color:yellow;">
4
</div>
</td>
<td>
<span>{{ form.solve(class_="button button_yellow") }}</span>
</td>
</tr>
</table>
</div>
</form>
</div>
You shouldn't use tables to do design, but if that's what you want, then I will come up with a solution for it.
Don't use inline styles. Refactor them to classes, so the HTML is readable.
Set position: relative on all TDs.
Place each element in a TD of its own.
Make the circular buttons absolute to position them on top of bottom right corner.
Use colspan to place the elements relative to each other.
Use border to draw the lines.
/** UNCOMMENT TO REVEAL THE ENTIRE STRUCTURE OF THE TABLE **/
/*td {
border: 2px solid rgba(0, 0, 0, 0.3) !important;
}*/
body {
font-family: Helvetica;
}
h1 {
color: DodgerBlue;
font-size: 4em;
text-decoration: underline;
text-decoration-color: red;
text-decoration-thickness: 1px;
margin: 2rem auto 1rem;
}
table {
border-collapse: collapse;
margin-left: auto;
margin-right: 1rem;
}
td.subtitle {
color: DodgerBlue;
font-size: 3em;
padding: 1rem;
}
td {
position: relative;
text-align: center;
border: 4px none black;
}
td.right-line {
border-right-style: solid;
}
td.bottom-line {
border-bottom-style: solid;
}
td.double-stroke {
border-width: 4px;
border-style: solid;
}
button {
display: flex;
justify-content: center;
align-items: center;
}
button.big {
margin: 1rem;
padding: 1rem 2rem;
font-size: 1.3rem;
width: calc(100% - 2rem);
box-sizing: border-box;
}
button.circle {
position: absolute;
right: 0px;
bottom: 0px;
transform: translate(50%, 50%);
width: 40px;
height: 40px;
line-height: 40px;
border-radius: 50%;
border: none;
font-size: 1.1rem;
font-weight: bold;
}
.blue.big {
background-color: LightSkyBlue;
}
.red {
background-color: OrangeRed;
}
.yellow {
background-color: yellow;
}
.lightgreen.circle {
background-color: lightgreen;
}
.blue.circle {
background-color: blue;
color:yellow;
}
<form action="" method="post" novalidate>
<table>
<tr>
<td colspan="4"></td>
<td class="bottom-line"><h1>Hashi</h1></td>
</tr>
<tr>
<td> </td>
<td colspan="3" class="subtitle right-line">Build bridges</td>
<td><button class="blue big">Create a Puzzle</button></td>
</tr>
<tr>
<td><button class="yellow circle">3</button></td>
<td class="bottom-line"><button class="red circle">2</button></td>
<td class="bottom-line right-line" colspan="2"><button class="lightgreen circle">5</button></td>
<td><button class="red big">Upload External</button></td>
</tr>
<tr>
<td class="right-line double-stroke"><button class="blue circle">4</button></td>
<td colspan="3"> </td>
<td><button class="yellow big">Run Internal</button></td>
</tr>
</table>
</form>
I'm fairly new to HTML so please bear with me. I'm trying to create a printable invoice in html. I'm having an issue with placing the top 2 tables side by side. Despite using inline-block, the tables are not being stacked next to each other
What am I doing wrong? Any help or suggestion would be greatly appreciated!
body {
padding: 1%;
padding-top: 3%;
font-family: Arial, Arial Black;
font-size: small;
}
.RetailerLogo {
position: absolute;
top: 0px;
width: 250px;
}
.RetailerLogo img {
width: 100%;
}
.RetailerOrderData {
position: absolute;
top: 20px;
right: 20px;
font-size: small;
}
.PageTitle {
font-family: Arial Black, Arial;
font-size: x-large;
border-bottom: 5px;
}
table thead {
font-family: Arial Black, Arial;
background: Pink;
color: Red;
height: 15px;
}
table thead td {
border-bottom: solid thin black;
}
table.Info {
width: 50%;
margin-bottom: 20px;
margin-right: 2%;
border-style: solid;
border-width: thin;
border-color: Red;
}
table.Info tbody td {
font-family: Arial;
height: 60px;
padding-top: -3px;
}
table.Contents {
width: 99%;
display: block;
text-align: center;
border-style: solid;
border-width: thin;
border-color: Black;
font-family: Arial;
font-size: small;
}
table.Contents tbody {
border-style: solid;
border-width: thin;
border-color: Black;
}
table.Contents tbody td {
padding-top: 0px;
margin-bottom: -5px;
}
table.Contents tbody tr {
padding-top: 0px;
margin-bottom: -5px;
}
<div class="RetailerLogo">
<img class="RetailerLogo" src="filepath" alt="Retailer Logo" />
</div>
<BR>
<BR>
<BR>
<BR>
<center>
<div class="PageTitle">Package Summary</div>
</center>
<BR>
<BR>
<BR>
<BR>
<BR>
<div class="RetailerOrderData">
<span style="FONT-SIZE: 10pt; FONT-FAMILY: AdvC39c; FONT-SIZE: 12pt; font-stretch:expanded;">
*%RETAILERORDERNUMBER%*
</span><br /> Order #: %RETAILERORDERNUMBER%<br /> Order Date: %RETAILERORDERDATE%<br /> Ship Method: %SHIPPINGMETHOD%<br/>
</div>
<table border="0" class="Info ShippingReturn">
<thead>
<tr>
<td>
Contact Info: Company Name
</td>
</tr>
</thead>
<tr>
<td>
%SHIPPINGRETURNADDRESS%<br/> Email: orders#gifpop.io
</td>
</tr>
</table>
<table class="Info ShipTo">
<thead>
<tr>
<td>
Shipped to: %CUSTOMERNAME%
</td>
</tr>
</thead>
<tr>
<td>
%SHIPPINGADDRESS%
</td>
</tr>
</table>
<table class="Contents">
<thead>
<tr>
<td width="125"><b>Image</b></td>
<td width="75"><b>Qty</b></td>
<td width="150"><b>Code</b></td>
<td width="320"><b>Description</b></td>
</tr>
</thead>
%SHIPMENTDETAILWITHIMAGE%
<tr>
<td width="125"> </td>
<td width="75"> </td>
<td width="150"> </td>
<td width="320"> </td>
</tr>
</table>
<b>
<b>
<b>
check out this hope this would work..capsule tables inside div and adjust using float property hope it would solve ur issue..
.floatLeft { width: 50%; float: left; }
.floatRight {width: 50%; float: right; }
.container { overflow: hidden; }
body {
padding: 1%;
padding-top: 3%;
font-family: Arial, Arial Black;
font-size: small;
}
.RetailerLogo {
position: absolute;
top: 0px;
width: 250px;
}
.RetailerLogo img {
width: 100%;
}
.RetailerOrderData {
position: absolute;
top: 20px;
right: 20px;
font-size: small;
}
.PageTitle {
font-family: Arial Black, Arial;
font-size: x-large;
border-bottom: 5px;
}
table thead {
font-family: Arial Black, Arial;
background: Pink;
color: Red;
height: 15px;
}
table thead td {
border-bottom: solid thin black;
}
table.Info {
width: 50%;
margin-bottom: 20px;
margin-right: 2%;
border-style: solid;
border-width: thin;
border-color: Red;
}
table.Info tbody td {
font-family: Arial;
height: 60px;
padding-top: -3px;
}
table.Contents {
width: 99%;
display: block;
text-align: center;
border-style: solid;
border-width: thin;
border-color: Black;
font-family: Arial;
font-size: small;
}
table.Contents tbody {
border-style: solid;
border-width: thin;
border-color: Black;
}
table.Contents tbody td {
padding-top: 0px;
margin-bottom: -5px;
}
table.Contents tbody tr {
padding-top: 0px;
margin-bottom: -5px;
}
<div class="RetailerLogo">
<img class="RetailerLogo" src="filepath" alt="Retailer Logo" />
</div>
<BR>
<BR>
<BR>
<BR>
<center>
<div class="PageTitle">Package Summary</div>
</center>
<BR>
<BR>
<BR>
<BR>
<BR>
<div class="RetailerOrderData">
<span style="FONT-SIZE: 10pt; FONT-FAMILY: AdvC39c; FONT-SIZE: 12pt; font-stretch:expanded;">
*%RETAILERORDERNUMBER%*
</span><br /> Order #: %RETAILERORDERNUMBER%<br /> Order Date: %RETAILERORDERDATE%<br /> Ship Method: %SHIPPINGMETHOD%<br/>
</div>
<div class="container">
<div class="floatLeft">
<table border="0" class="Info ShippingReturn">
<thead>
<tr>
<td>
Contact Info: Company Name
</td>
</tr>
</thead>
<tr>
<td>
%SHIPPINGRETURNADDRESS%<br/> Email: orders#gifpop.io
</td>
</tr>
</table>
</div>
<div class="floatRight">
<table class="Info ShipTo">
<thead>
<tr>
<td>
Shipped to: %CUSTOMERNAME%
</td>
</tr>
</thead>
<tr>
<td>
%SHIPPINGADDRESS%
</td>
</tr>
</table></div>
</div>
<table class="Contents">
<thead>
<tr>
<td width="125"><b>Image</b></td>
<td width="75"><b>Qty</b></td>
<td width="150"><b>Code</b></td>
<td width="320"><b>Description</b></td>
</tr>
</thead>
%SHIPMENTDETAILWITHIMAGE%
<tr>
<td width="125"> </td>
<td width="75"> </td>
<td width="150"> </td>
<td width="320"> </td>
</tr>
</table>
<b>
<b>
<b>
i used ur code and mould it little like wrapping tables inside div and add css accordingly
The easiest : You can turn those 2 tables into table-cell, so they'll stick together side by side (demo below),
else: you'll need to float them or a wrapper to hold them and some extra CSS to keep them side by side no matter what the width avalaible. (possibly inline-block along white-space )
.Info {
display:table-cell;
}
body {
padding: 1%;
padding-top: 3%;
font-family: Arial, Arial Black;
font-size: small;
}
.RetailerLogo {
position: absolute;
top: 0px;
width: 250px;
}
.RetailerLogo img {
width: 100%;
}
.RetailerOrderData {
position: absolute;
top: 20px;
right: 20px;
font-size: small;
}
.PageTitle {
font-family: Arial Black, Arial;
font-size: x-large;
border-bottom: 5px;
}
table thead {
font-family: Arial Black, Arial;
background: Pink;
color: Red;
height: 15px;
}
table thead td {
border-bottom: solid thin black;
}
table.Info {
width: 50%;
margin-bottom: 20px;
margin-right: 2%;
border-style: solid;
border-width: thin;
border-color: Red;
}
table.Info tbody td {
font-family: Arial;
height: 60px;
padding-top: -3px;
}
table.Contents {
width: 99%;
/*display: block;*/
text-align: center;
border-style: solid;
border-width: thin;
border-color: Black;
font-family: Arial;
font-size: small;
}
table.Contents tbody {
border-style: solid;
border-width: thin;
border-color: Black;
}
table.Contents tbody td {
padding-top: 0px;
margin-bottom: -5px;
}
table.Contents tbody tr {
padding-top: 0px;
margin-bottom: -5px;
}
<div class="RetailerLogo">
<img class="RetailerLogo" src="filepath" alt="Retailer Logo" />
</div>
<BR>
<BR>
<BR>
<BR>
<center>
<div class="PageTitle">Package Summary</div>
</center>
<BR>
<BR>
<BR>
<BR>
<BR>
<div class="RetailerOrderData">
<span style="FONT-SIZE: 10pt; FONT-FAMILY: AdvC39c; FONT-SIZE: 12pt; font-stretch:expanded;">
*%RETAILERORDERNUMBER%*
</span><br /> Order #: %RETAILERORDERNUMBER%<br /> Order Date: %RETAILERORDERDATE%<br /> Ship Method: %SHIPPINGMETHOD%<br/>
</div>
<table border="0" class="Info ShippingReturn">
<thead>
<tr>
<td>
Contact Info: Company Name
</td>
</tr>
</thead>
<tr>
<td>
%SHIPPINGRETURNADDRESS%<br/> Email: orders#gifpop.io
</td>
</tr>
</table>
<table class="Info ShipTo">
<thead>
<tr>
<td>
Shipped to: %CUSTOMERNAME%
</td>
</tr>
</thead>
<tr>
<td>
%SHIPPINGADDRESS%
</td>
</tr>
</table>
<table class="Contents">
<thead>
<tr>
<td width="125"><b>Image</b></td>
<td width="75"><b>Qty</b></td>
<td width="150"><b>Code</b></td>
<td width="320"><b>Description</b></td>
</tr>
</thead>
%SHIPMENTDETAILWITHIMAGE%
<tr>
<td width="125"> </td>
<td width="75"> </td>
<td width="150"> </td>
<td width="320"> </td>
</tr>
</table>
<b>
<b>
<b>
Try implementing the declaration display: grid to build your tables side-by-side. The grid value offers fully responsive 'boxes' that can be stacked as you wish.
This is a simple layout~
HTML
<section class="tableGrid">
<div>
<div>
<p>Row 1 - Table 1</p>
</div>
<div>
<p>Row 2 - Table 1</p>
</div>
</div>
<!-- ********************** -->
<div>
<div>
<p>Row 1 - Table 2</p>
</div>
<div>
<p>Row 2 - Table 2</p>
</div>
</div>
</section>
and CSS
.tableGrid {
margin: 4vh 8vw;
padding: 16px;
display: grid;
grid-template-rows: auto;
grid-gap: 16px;
}
.table {
border: 4px dotted red;
}
#media (min-width: 800px) {
.tableGrid {
margin: 8vh 16vw;
padding: 32px;
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(auto-fit: minmax(88px 1fr);
grid-gap: 24px;
}
}
Check out this pen and if you like what you see learn more about using grid here.
on the image as you can see 'Sezon' and 'Poza sezonem' blocks are on another blocks(ND-CZW, PT-SB)
I'm trying to write html code of this image. how can I put Sezon,poza sezonem blocks on the blocks below?
<div class="parent">
<tr>
<td style="text-align: center;background-color: #E96165;color: #fff">Ilosc
gosci</td>
<td class="baslik1">Sezon</td>
<td class="baslik1">Poza sezonem</td>
<td class="baslik1">Poza sezonem 2</td>
</tr>
<tr>
<td class="baslik2"> </td>
<td class="baslik2">ND-CZW</td>
<td class="baslik2">PT-SB</td>
<td class="baslik2">ND-CZW</td>
</tr>
</div>
I would use Flexbox with absolute positioning like this:
.parent {
display: flex;
}
.table {
display: flex;
flex-direction: column;
box-shadow: 0 20px 30px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
background: lightgrey;
}
.table:nth-child(2) {
z-index: 2;
}
.table:nth-child(3) {
z-index: 3;
}
.table > div {
display: flex;
flex-direction: row;
}
.cell {
box-sizing: border-box;
display: flex;
height: 60px;
width: 200px;
border-bottom: 1px solid grey;
}
.cell--head {
height: 60px;
position: relative;
}
.cell--logo {
background-color: #E96165;
color: #fff;
padding: 0;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
}
.cell--head > div {
padding-top: 30px;
}
.cell > div {
flex: 1;
text-align: center;
border-left: 1px solid grey;
padding: 20px;
}
.cell > div:first-of-type {
border-left: 0;
}
.label {
position: absolute;
top: -2px;
background: black;
color: white;
transform: translate(-50%, 0%);
left: 50%;
padding: 5px;
font-size: 10px;
}
<div class="parent">
<div class="table">
<div class="cell cell--logo">
Ilosc gosci
</div>
<div class="cell">
Ilosc gosci
</div>
</div>
<div class="table">
<div class="cell cell--head">
<span class="label">Sezon</span>
<div>ND-CZW</div>
<div>ND-CZW</div>
</div>
<div class="cell">
<div>245 pln</div>
<div>245 pln</div>
</div>
</div>
<div class="table">
<div class="cell cell--head">
<span class="label">Poza sezonem</span>
<div>ND-CZW</div>
<div>ND-CZW</div>
</div>
<div class="cell">
<div>245 pln</div>
<div>245 pln</div>
</div>
</div>
<div>
<td class="baslik2"></td>
<td class="baslik2"></td>
<td class="baslik2"></td>
<td class="baslik2"></td>
</div>
</div>
</div>
Your code seems to have some wrong syntax, I tried achieve the same in the fiddle below
http://jsfiddle.net/Parthoghsh820/akhwgg2f/3/
<table>
<thead>
<tr class="header">
<th colspan="2">
<span>Major 1</span>
</th>
<th colspan="2">
<span>Major 2</span>
</th>
</tr>
<tr class="subheader">
<th>col1</th>
<th>col2</th>
<th>col3</th>
<th>col4</th>
</tr>
</thead>
<tbody>
<tr>
<td>data1</td>
<td>data2</td>
<td>data3</td>
<td>data4</td>
</tr>
</tbody>
http://codepen.io/anon/pen/dOGWQW
Screenshots of what is wrong:
http://imgur.com/a/JjNLn
No matter what I try to change, I can't get the part that says "May we suggest", or below that where it says "Want more products?", to be centered in gmail's mobile app.
If you turn the phone in landscape mode it all displays right, but with the normal vertical view the width of the block is not 100% even though the text is still centered.
Then the footer text is just text aligned left for some reason.
On gmail.com on Chrome mobile, the whole template looks like its not at all designed for mobile and is full desktop width.
How do I debug this?
I can't use any kind of dev tool in these programs and nothing I can think of in the code should be making it do this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--[if !mso]><!-->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!--<![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<link rel="stylesheet" type="text/css" href="styles.css" />
<style type="text/css">
/* Basics */
body {
Margin: 0;
padding: 0;
min-width: 100%;
background-color: #fff;
}
table {
border-spacing: 0;
font-family: sans-serif;
color: #123050;
}
td {
padding: 0;
}
table, tbody, tr, td {
border: none;
border-color: #fff;
}
img {
border: 0;
}
.wrapper {
width: 100%;
table-layout: fixed;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
.webkit {
max-width: 600px;
border: 1px solid #e1e1e1;
box-shadow: 0 0 100px 0 rgba(0, 0, 0, 0.15);
}
.outer {
Margin: 0 auto;
width: 100%;
max-width: 600px;
background: #fff;
}
.inner {
padding: 10px;
}
.contents {
width: 100%;
}
p {
Margin: 0;
}
a {
color: #ed9d2a;
text-decoration: none;
}
.h1 {
font-size: 21px;
font-weight: bold;
Margin-bottom: 18px;
}
.h2 {
font-size: 18px;
font-weight: bold;
Margin-bottom: 12px;
}
.full-width-image img {
width: 100%;
max-width: 600px;
height: auto;
}
/* One column layout */
.one-column .contents {
text-align: left;
}
.one-column p {
font-size: 14px;
Margin-bottom: 10px;
}
/*Two column layout*/
.two-column {
text-align: center;
font-size: 0;
}
.two-column .column {
width: 100%;
max-width: 300px;
display: inline-block;
vertical-align: top;
}
.two-column .contents {
font-size: 14px;
text-align: left;
border:1px solid #dedede;
border-radius: 3px;
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1);
margin-bottom: 15px;
}
.two-column img {
width: 100%;
max-width: 280px;
height: auto;
}
.two-column .image {
padding: 9px 5px 0;
}
.two-column .text {
padding: 0 5px 17px;
padding-top: 10px;
}
/*Three column layout*/
.three-column {
text-align: center;
font-size: 0;
padding-top: 10px;
padding-bottom: 10px;
}
.three-column .column {
width: 100%;
max-width: 200px;
display: inline-block;
vertical-align: top;
}
.three-column img {
width: 100%;
max-width: 180px;
height: auto;
}
.three-column .contents {
font-size: 14px;
text-align: center;
}
.three-column .text {
padding-top: 10px;
}
/* Left sidebar layout */
.left-sidebar {
text-align: center;
font-size: 0;
}
.left-sidebar .column {
width: 100%;
display: inline-block;
vertical-align: middle;
}
.left-sidebar .left {
max-width: 100px;
}
.left-sidebar .right {
max-width: 500px;
}
.left-sidebar .img {
width: 100%;
max-width: 80px;
height: auto;
}
.left-sidebar .contents {
font-size: 14px;
text-align: center;
}
.left-sidebar a {
color: #85ab70;
}
/* Right sidebar layout */
.right-sidebar {
text-align: center;
font-size: 0;
}
.right-sidebar .column {
width: 100%;
display: inline-block;
vertical-align: middle;
}
.right-sidebar .left {
max-width: 100px;
}
.right-sidebar .right {
max-width: 500px;
}
.right-sidebar .img {
width: 100%;
max-width: 80px;
height: auto;
}
.right-sidebar .contents {
font-size: 14px;
text-align: center;
}
.right-sidebar a {
color: #70bbd9;
}
h2.featured {
font-size: 39px;
letter-spacing: -1px;
font-weight: bold;
font-style: italic;
color: #ffad38;
text-align: center;
margin: 0 auto 0px;
}
.subtitle {
font-size: 14px;
font-style: italic;
color: #7c8697;
text-align: center;
margin-bottom: 30px;
}
.bold {
font-weight: bold;
}
.header {
text-align: center;
padding-bottom: 25px;
}
.header-wrap {
background: #123050 center bottom no-repeat;
display: block;
width: 100%;
}
img.header-desktop {
display: block;
width: 100%;
}
img.header-mobile {
display: none;
height:1px;
width: 1px;
}
h3 {
color: #123050;
font-size: 27px;
text-align: center;
font-weight:900;
text-transform: uppercase;
letter-spacing: -1px;
margin-top: 0;
margin-bottom: 20px;
}
h4.suggest {
text-transform: uppercase;
font-weight: 900;
font-size: 17px;
letter-spacing: -1.5px;
margin-top: 0;
margin-bottom: 10px;
}
td.suggest {
padding-top: 31px;
}
h5 {
text-transform: uppercase;
font-weight: bold;
margin-top: 10px;
margin-bottom:3px;
}
h3.fancy {
margin: 0 0 43px;
}
h3.fancy a {
color: #123050;
font-size: 24px;
text-transform: none;
font-weight: 600;
letter-spacing: 0;
margin: 0 0 43px;
}
h3.fancy a span {
color: #367eeb;
transition: 75ms ease-in color;
}
h3.fancy a:hover span {
color: #123050;
}
h4.fancy {
font-size: 17px;
font-weight: normal;
font-style: italic;
margin: 0 0 10px;
}
p.phone {
margin-bottom: 5px;
}
.category {
font-size: 13px;
font-style: italic;
margin-bottom: 30px;
}
p.feature-desc {
color: #414d62;
max-width: 465px;
margin: 0 auto;
margin-bottom: 40px;
}
a.button {
font-size: 14px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: -0.5px;
border: 2px solid #ffaf3d;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
height: 37px;
width: 127px;
line-height: 37px;
text-decoration: none;
display: inline-block;
}
.button img {
display: none;
}
a.button-view {
background: #ffaf3d;
color: #fff;
}
a.button-info {
color: #ffaf3d;
width: 103px;
}
a.button-view:hover {
border-color: #ed9d2a;
background: #ed9d2a;
color: #fff;
}
a.button-info:hover {
background: #ffaf3d;
color: #fff;
}
.td-button {
font-size: 14px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: -0.5px;
border: 2px solid #ffaf3d;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
height: 37px;
width: 127px;
line-height: 37px;
text-decoration: none;
display: inline-block;
}
.td-view {
background: #ffaf3d;
color: #fff;
}
.td-info {
color: #ffaf3d;
width: 103px;
}
.td-view a {
color: #fff;
height: 37px;
width: 127px;
line-height: 37px;
display: block;
text-align: center;
}
.td-info a {
color: #ffaf3d;
height: 37px;
width: 103px;
display: block;
}
.td-view:hover {
border-color: #ed9d2a;
background: #ed9d2a;
color: #fff;
}
.td-info:hover {
background: #ffaf3d;
color: #fff;
}
.td-view:hover a {
border-color: #ed9d2a;
background: #ed9d2a;
color: #fff;
}
.td-info:hover a {
background: #ffaf3d;
color: #fff;
}
a.small-button {
color: #152845;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
margin: 3px 0;
text-decoration: none;
}
img.separator {
width: auto;
height: 10px;
display: inline-block;
padding: 0;
margin: 0;
}
a.small-button-view {
}
a.small-button:hover {
color: #384c69;
}
.shadow {
box-shadow: 0px 5px 9px -5px rgba(0,0,0,0.2);
border-bottom: 1px solid #ddd;
padding-top: 37px;
padding-bottom: 35px;
}
.more {
padding-top: 22px;
padding-bottom: 47px;
text-align: center !important;
box-sizing: border-box;
display: inline-block;
margin-left: auto;
margin-right: auto;
}
.footer {
background: #123050;
}
.footer p {
color: #fff;
height: 45px;
padding-top: 10px;
margin: 0;
text-align: center;
}
.footer a {
color: #fff;
display: inline-block;
height: 40px;
}
.footer span {
padding-right: 5px;
}
.center, .text, h4, h5 {
text-align: center;
}
#media (max-width:599px) {
/* img.header-mobile {
display: inline !important;
height: auto;
width: auto;
}
img.header-desktop {
display: none;
height: 1px;
width: 1px;
}
*/
.one-column .contents {
text-align: center !important;
}
}
</style>
<!--[if (gte mso 9)|(IE)]>
<style type="text/css">
table {border-collapse: collapse;}
</style>
<![endif]-->
</head>
<body>
<center class="wrapper">
<div class="webkit">
<!--[if (gte mso 9)|(IE)]>
<table width="600" align="center">
<tr>
<td>
<![endif]-->
<table class="outer" align="center">
<tr>
<td class="header">
<a class="header-wrap" href="">logo</a>
</td>
</tr>
<tr>
<td>
<h2 class="featured">Featured Product</h2>
</td>
</tr>
<tr>
<td>
<p class="subtitle">Recommendations for <span class="bold">All Star Marketing</span></p>
</td>
</tr>
<tr>
<td class="full-width-image">
<img src="http://www.inventionhome.com/dev/hotlink/images/featured.jpg" width="600" alt="" />
</td>
</tr>
<tr>
<td class="one-column">
<table width="100%">
<tr>
<td style="padding-top: 37px; padding-bottom: 35px;" class="inner contents shadow">
<h3>Item Name</h3>
<p class="feature-desc">Item Name is an electronic warmer, featuring a lightweight design that enables easy transportation of a hot food item between locations.</p>
<div style="width: 243px; margin: 0 auto; text-align: center;">
<table width="100%; max-width: 243px;">
<tr>
<td class="td-button td-view" valign="middle" align="center">
<p style="display: block;">View Product</p><p style="display: block; height: 7px;"> </p>
</td>
<td>
<img src="http://www.inventionhome.com/dev/hotlink/images/5x20.png" alt="" />
</td>
<td class="td-button td-info" valign="middle" align="center">
<p style="display: block;">More Info</p><p style="display: block; height: 7px;"> </p>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="one-column">
<!--[if (gte mso 9)|(IE)]>
<table width="100%">
<tr>
<td width="50%" valign="top">
<![endif]-->
<div class="column">
<table width="100%">
<tr>
<td class="inner">
<table class="contents">
<tr>
<td style="padding-top: 31px;" class="inner contents suggest">
<h4 class="suggest" vspace="50">May we also suggest</h4>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top">
<![endif]-->
</td>
</tr>
<tr>
<td class="two-column">
<!--[if (gte mso 9)|(IE)]>
<table width="100%">
<tr>
<td width="50%" valign="top">
<![endif]-->
<div class="column">
<table width="100%">
<tr>
<td class="inner">
<table class="contents">
<tr>
<td class="image">
<img src="http://www.inventionhome.com/dev/hotlink/images/1.jpg" width="280" alt="" />
</td>
</tr>
<tr>
<td class="text">
<h5>Item Name</h5>
<p class="category">Kitchen</p>
<p>
<a class="small-button small-button-view" href="" title="">View Product</a>
<img class="separator" src="http://www.inventionhome.com/dev/hotlink/images/separator.jpg" alt="" />
<a class="small-button small-button-info" href="" title="">More Info</a>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top">
<![endif]-->
<div class="column">
<table width="100%">
<tr>
<td class="inner">
<table class="contents">
<tr>
<td class="image">
<img src="http://www.inventionhome.com/dev/hotlink/images/2.jpg" width="280" alt="" />
</td>
</tr>
<tr>
<td class="text">
<h5>Item Name</h5>
<p class="category">Kitchen</p>
<a class="small-button small-button-view" href="" title="">View Product</a>
<img class="separator" src="http://www.inventionhome.com/dev/hotlink/images/separator.jpg" alt="" />
<a class="small-button small-button-info" href="" title="">More Info</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<tr>
<td class="two-column">
<!--[if (gte mso 9)|(IE)]>
<table width="100%">
<tr>
<td width="50%" valign="top">
<![endif]-->
<div class="column">
<table width="100%">
<tr>
<td class="inner">
<table class="contents">
<tr>
<td class="image">
<img src="http://www.inventionhome.com/dev/hotlink/images/two-column-01.jpg" width="280" alt="" />
</td>
</tr>
<tr>
<td class="text">
<h5>Item Name</h5>
<p class="category">Kitchen</p>
<a class="small-button small-button-view" href="" title="">View Product</a>
<img class="separator" src="http://www.inventionhome.com/dev/hotlink/images/separator.jpg" alt="" />
<a class="small-button small-button-info" href="" title="">More Info</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top">
<![endif]-->
<div class="column">
<table width="100%">
<tr>
<td class="inner">
<table class="contents">
<tr>
<td>
<img src="http://www.inventionhome.com/dev/hotlink/images/4.jpg" width="280" alt="" />
</td>
</tr>
<tr>
<td class="text">
<h5>Item Name</h5>
<p class="category">Kitchen</p>
<a class="small-button small-button-view" href="" title="">View Product</a>
<img class="separator" src="http://www.inventionhome.com/dev/hotlink/images/separator.jpg" alt="" />
<a class="small-button small-button-info" href="" title="">More Info</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<tr>
<td class="one-column">
<table width="100%">
<tr>
<td class="inner contents more">
<h4 class="fancy">Want more products?</h4>
<h3 class="fancy">Visit <span>Us Here</span></h3>
<h4 class="fancy">Contact us at</h4>
<p class="center phone"><strong>1-888-888-7777</strong></p>
<p class="center"><a style="font-weight: bold;" href="mailto:marketing#inventionhome.com" title="email">marketing#company.com</a></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="background: #123050;" class="one-column footer">
<table width="100%">
<tr>
<td class="inner contents">
<p class="center"><span style="color: #fff;">Connect with us</span> <a class="social-icon" href="https://www.facebook.com/invention.home/" title=""><img src="http://www.inventionhome.com/dev/hotlink/images/facebook.png" alt="Facebook" /></a><a class="social-icon" href="https://twitter.com/Inventionhome" title=""><img src="http://www.inventionhome.com/dev/hotlink/images/twitter.png" alt="Twitter" /></a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</div>
</center>
</body>
</html>
I sent an email to my gmail account with your code in it, then viewed it on my phone and it looks absolutely perfect.
But as you said, if I use the chrome browser and log into to gmail it looks just how you described.
The reason is that GMAIL is stripping away your inline Stylesheet, when viewed in the browser. The original message is intact, but the client renders it without the stylesheets.
To get around the issue, you need to code the styles using the style attribute on the HTML Element, like this.
<table style="text-align:center">
Now your next question is how do I know this? I hit F12 in google chrome on my desktop, then view the email. This allows me to see the HTML and the Styles applied. Then within the Developer tools I click on the Toggle Device Toolbar then select the device I want to emulate in this case I choose iPhone 6+.
Then you can look at the html and adjust it and correct it within the tools.
I would also suggest you do some Inbox Testing, looking over the content of the email I think you're going to hit the spam box at a few locations.