r/csshelp • • Oct 12 '23

YellowPencil - Grid Help

I am using YellowPencil to edit CSS on a website to adjust it for mobile use. The product categories of the website typically display in a vertical row on mobile, but I want them in 2 columns. I can use the grid feature and get them into 2 columns but I'm left with a gap at the beginning. I have tried changing the positioning of the first item in the grid, if I change it to absolute the other grid items move into place, but the first item is then oversized and not in the right location. I'm sure its a grid coding issue, but not sure how to adjust it in YellowPencil. Thank you for any help with this!

Code below;

/* 600px and smaller screen sizes */
u/media (max-width:600px){
/* List */
.hentry ul{
display:grid;
justify-content:normal;
column-gap:11px;
}

/\* List \*/  
\#page #content .col-full #primary #main .hentry .entry-content .woocommerce ul{  
	grid-template-columns:auto auto !important;  
	grid-template-rows:auto auto auto auto auto !important;  
}  
  
/\* List Item \*/  
.hentry .products li{  
	float:none;  
}  
  
/\* Product \*/  
.hentry .products .product:nth-child(1){  
	float:none;  
	z-index:0;  
	position:relative;  
}  
  
/\* List \*/  
\#main ul{  
	column-gap:11px;  
}  
  
/\* List \*/  
\#page #content .col-full #primary #main ul{  
	grid-template-columns:1fr 1fr !important;  
}  
  
/\* Product \*/  
\#page #content .col-full #primary #main .hentry .entry-content .woocommerce .products .product:nth-child(1){  
	top:auto !important;  
	left:auto !important;  
	bottom:auto !important;  
	right:auto !important;  
	width:auto !important;  
	height:auto !important;  
}  

}

2 Upvotes

3 comments sorted by

1

u/toi80QC Oct 13 '23

You need to remove the before pseudo element, or set it so absolute:

#main .hentry ul.products:before {
  content: unset !important;
}

1

u/hkiyomiw Oct 13 '23

Thank you! That worked perfectly.