For this, I added some styling to the alto theme in post.css. Then I used the created class and added a table. The table CSS wont show or wont apply to the table. The head of the table remains transparent, even if it’s set to orange.
orry I am kind of newbie with css. Hope you can debug me. Here’s the code I added to posts.css and the HTML of the rendered page.
Code of post.css
.post {
margin-bottom: 100px;
}
.post-media {
margin-bottom: 20px;
}
.post-feed .post-media {
width: 100%;
max-width: calc(960px + var(--gap) * 2);
margin: 0 auto 40px;
}
.post-media-tag {
position: absolute;
top: 15px;
right: 15px;
z-index: 10;
padding: 2px 10px;
font-size: 13px;
font-weight: 600;
color: var(--white-color);
background: var(--primary-color);
border-radius: 15px;
}
.post-image-link:hover {
opacity: 1;
}
.post-header {
display: flex;
flex-direction: column-reverse;
gap: 10px;
}
.post-title {
font-size: 30px;
font-weight: 800;
letter-spacing: -0.01em;
word-break: break-word;
}
.has-serif-title :where(.post-feed, .single-post) .post-title {
font-family: var(--font-serif);
}
.post-meta {
font-size: 12px;
font-weight: 700;
color: var(--secondary-text-color);
text-transform: uppercase;
letter-spacing: 0.01em;
}
.post-meta-item:not(:first-of-type)::before {
padding: 0 7px 0 4px;
font-family: serif;
content: "/";
}
.post-tag {
color: var(--primary-color);
}
.post-excerpt {
margin-top: 12px;
word-break: break-word;
}
.has-serif-body .post-excerpt {
font-family: var(--font-serif);
}
@media (max-width: 767px) {
.post-media.large {
margin-bottom: 30px;
}
.post-feed .post-title {
font-size: 24px;
}
}
.gh-content .table-container {
margin-bottom: 1.5625rem;
overflow-x: auto;
width: 100%;
word-break: normal
}
@media only screen and (min-width: 48rem) {
.gh-content .table-container {
margin-bottom:2.1875rem
}
}
.gh-content table {
background-color: transparent;
color: var(--alt-text-color);
font-size: .875rem;
max-width: 100%;
width: 100%
}
@media only screen and (min-width: 48rem) {
.gh-content table {
font-size:.9375rem
}
}
.gh-content table thead th {
background-color: #f27a17;
color: #ffffff;
font-weight: 500;
padding: .8125rem
}
@media only screen and (min-width: 48rem) {
.gh-content table thead th {
padding:.875rem
}
}
.gh-content table tbody tr:nth-child(2n) {
background-color: var(--mask-color)
}
.gh-content table tbody td {
padding: .8125rem;
text-align: center
}
@media only screen and (min-width: 48rem) {
.gh-content table tbody td {
padding:.875rem
}
}
Rendered page where the table was inserted
<div class="site-content">
<div class="content-area">
<main class="site-main">
<article class="post no-image no-image single-post">
<header class="article-header gh-canvas">
<h1 class="post-title">Table example</h1>
</header>
<div class="gh-content gh-canvas">
<!--kg-card-begin: html-->
<div class="table-container">
<table>
<thead>
<tr>
<th>#</th>
<th>Heading</th>
<th>Heading</th>
<th>Heading</th>
<th>Heading</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>2</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
</tbody>
</table>
</div>
<!--kg-card-end: html-->
</div>
</article>
</main>
</div>
</div>
My rendered table