Skip to content

Instantly share code, notes, and snippets.

@ajaydsouza
Last active February 20, 2021 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajaydsouza/462b41930c325e6bc345 to your computer and use it in GitHub Desktop.
Save ajaydsouza/462b41930c325e6bc345 to your computer and use it in GitHub Desktop.
Contextual Related Posts Grid styles
.crp_related ul {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 10px;
margin: 0;
justify-items: center;
list-style: none;
}
.crp_related ul li {
text-align:center;
}
.crp_related .crp_thumb, .crp_related .crp_title {
display: block;
margin: 0 auto;
}
.crp_related {
width: 100%;
}
.crp_related ul {
display: flex;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
flex-wrap: wrap;
-webkit-flex-wrap: wrap;
width: 100% !important;
justify-content: space-between;
-webkit-justify-content: space-between;
}
a.crp_link {
width: 100%;
}
.crp_title {
display: inline-block;
width: 100% !important;
margin: auto;
max-width: 100% !important;
border-radius: 0 !important;
}
.crp_thumb {
width: 100%;
object-fit: cover;
}
@media only screen and (min-width: 320px) {
.crp_related ul li {
width: CALC(50% - 10px) !important;
}
}
@media only screen and (min-width: 700px) {
.crp_related ul li {
width: CALC(33% - 10px) !important;
}
}
@media only screen and (min-width: 900px) {
.crp_related ul li {
width: CALC(25% - 10px) !important;
}
}
/* Related Posts */
.crp_related {
margin:0 0 30px;
padding: 0 0 15px;
border-bottom: 1px solid #F1F1F1;
}
.crp_related h3 {
margin:0 0 15px;
}
.crp_related ul li {
list-style-type:none;
float:left;
margin:0 40px 0 0;
width: 230px;
}
.crp_related ul li:nth-child(3n+3) {
margin:0;
}
.crp_related ul li a {
display: block;
font-weight: bold;
word-wrap:break-word;
}
.crp_related ul li img {
margin:0 0 15px;
}
.crp_title{float:left; clear:left!important;}
.crp_thumb{align:center!important;}
.crp_related { margin-bottom:20px; margin-bottom:20px;padding:10px 0; width:100%;}
.crp_related ul { margin-bottom:0px; margin-left:0px; height:320px;list-style:none;padding-left:10px; }
.crp_related ul li { float:left; width:120px; padding:0px 6px 0px 0px; list-style:none;list-style-position: inside; height:180px;text-align: left;word-wrap:break-word; }
.crp_related ul li a {margin-bottom:10px;list-style-position: outside;word-wrap:break-word;list-style:none!important;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment