Codes for displaying blogger posts in grid view with thumbnails
Here's an example of HTML and CSS code that displays Blogger posts in a grid view with thumbnails:
HTML:
<div class="post-grid">
<b:loop values='data:posts' var='post'>
<div class="post">
<a expr:href='data:post.url'>
<img expr:src='data:post.thumbnailUrl'/>
<h2><data:post.title/></h2>
</a>
</div>
</b:loop>
</div>
.post-grid {display: grid;grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));grid-gap: 20px;margin: 0 auto;max-width: 1200px;}.post {position: relative;overflow: hidden;}.post img {width: 100%;height: auto;transition: transform 0.2s ease-out;}.post:hover img {transform: scale(1.1);}.post h2 {position: absolute;bottom: 0;left: 0;right: 0;background-color: rgba(0, 0, 0, 0.7);color: #fff;padding: 10px;margin: 0;}
- Log in to your Blogger account and go to your blog's dashboard.
- Click on "Theme" in the left sidebar.
- Click on "Edit HTML" button.
- Look for the <head> section of your template, and paste the CSS code above it.
- Look for the section of your template where you want to display the grid of posts. You can create a new page or post, or modify an existing one.
- Paste the HTML code above into the section where you want to display the grid of posts.
- Save your changes and preview your blog to see the grid view of posts with thumbnails.
Comments
Post a Comment