How to display blogger posts in grid view with thumbnails
So you also have the same query which we have for this blog. We want to display our posts in grid view with thumbnails. After spending hours and hours on internet in search of a code for this purpose, we found one on a blog which is working perfectly for our blog. You can find the code here: https://helplogger.blogspot.com/2014/05/display-blogger-posts-in-grid-view-with-thumbnails.html
However there are many questions which we have and we need answers of those questions to make a better look of our blog. Let´s start with the questions which we have solved till now.
What should be changed in this code so that text should be in black letters?
To change the color of the text to black, you can add a CSS rule to the style section:
.postThumbnail a.postThumbnail div {
color: black;
}
a.postThumbnail div {background-color: #ffffff;}
a.postThumbnail div {text-decoration: none;color: #ffffff;padding:0 5px;height:120px;font:bold 15px/20px "Trebuchet MS",Trebuchet,Verdana,sans-serif;text-transform: capitalize;background-color: transparent; /* add this line */}
.post {width:30.3%;float:left;display:inline-block;border-bottom: medium none;margin: 0 1% 2%;padding-bottom: 0;}
To reduce the space between two rows of posts, you can decrease the bottom margin by changing the margin-bottom value from 2% to a smaller value, for example, 1% or 0.5%.
For example, you can change the code to:
.post {
width:30.3%;
float:left;
display:inline-block;
border-bottom: medium none;
margin: 0 1% 1%;
padding-bottom: 0;
}
- The CSS selector you are using to target the rows of posts may not be correct. Double-check that you are using the correct selector and that it is targeting the rows you want to modify.
- The CSS property you are using to reduce the spacing may not be the correct one. Make sure you are using the appropriate property for adjusting vertical spacing, such as "margin" or "padding", and that you are modifying the correct values (e.g. top or bottom margin).
- The CSS specificity of your style rule may not be strong enough to override the default spacing. Try adding a more specific selector to your CSS rule, such as a class or ID, to give it more weight.
- There may be other styles in your CSS that are overriding your spacing changes. Try using your browser's developer tools to inspect the element and see which styles are being applied, and adjust your CSS accordingly.
.post-grid {display: flex;flex-wrap: wrap;margin: -10px; /* adjust this value as needed */}.post-grid .post {flex: 0 0 25%; /* adjust this value as needed */padding: 10px; /* adjust this value as needed */box-sizing: border-box;}.post-grid .post:nth-child(n+5) {margin-top: 0; /* adjust this value as needed */}
.post {/* existing styles */margin-bottom: 20px; /* replace this value with your desired space between rows */}
<style>/* Reduce space between rows of posts */.post { margin-bottom: 10px; }/* Make background of text white and transparent */.text-white { background-color: rgba(255, 255, 255, 0.7); }/* Reduce space between two rows of posts */.post + .post { margin-top: 10px; }</style>
Comments
Post a Comment