grid

How can we target the main-grid container grid lines for the grid item placed inside another grid container.(scale upwards)
No description
30 Replies
ProdJuan
ProdJuan7mo ago
not sure why your existing class .text-image-section doesn't accomplish already.
Vandana
VandanaOP7mo ago
Thanks for responding.it accomplishes a grid green lines...blue lines are the main container grid lines @ProdJuan ?
MarkBoots
MarkBoots7mo ago
by making the .text-image-section a subgrid that spans over columns: 1 to -1
.text-image-section{
grid-column: 1/-1;
display: grid;
grid-template-columns: subgrid;
}
.text-image-section{
grid-column: 1/-1;
display: grid;
grid-template-columns: subgrid;
}
Vandana
VandanaOP7mo ago
since i made the text-image-section a nested grid,now i am unable to position the scenary image (img-four) inside the nested grid because of the main grid line its occuping
No description
Vandana
VandanaOP7mo ago
there is no clean CSS method for moving nested elements into the main grid container.???
MarkBoots
MarkBoots7mo ago
this is the way to nest grid. don't know what you think is not clean about it ah, i see what you mean. in this case you don't want to span from 1 to -1. you can remove that line i thought you wanted it to be the full width
Vandana
VandanaOP7mo ago
now i need to move that car image of out the nest grid and span somewhere in the main grid
No description
Vandana
VandanaOP7mo ago
This is my question there is no clean CSS method for moving nested elements into the main grid container.??? If it is there then how?
MarkBoots
MarkBoots7mo ago
ohw, no, indeed. But, why put it in that section in the first place (html)?
Vandana
VandanaOP7mo ago
That is the requirement as per the design I had designed for mobile devices that is why now large screen sizes is becoming messy
MarkBoots
MarkBoots7mo ago
no, can't see a way. either you take it out of the html (level up), or you put the mountain image in it, you can not do half/half.
Vandana
VandanaOP7mo ago
Not getting what do you mean?
MarkBoots
MarkBoots7mo ago
you have 2 elements in text-image-section, but you want 1 item to be taken out of it. maybe, you can get around with it by setting .text-image-section {display: contents} , then the 2 elements will be childs directly of the main container. bit hard to tell without live code
Vandana
VandanaOP7mo ago
yes ,something works.. with display:contents when do we use this property??
MarkBoots
MarkBoots7mo ago
i did use this before we had subgrid. or sometimes it is nice to just group things (just for clearness) but not wanting it to be grouped (it will just ignore that_
Vandana
VandanaOP7mo ago
I have mentioned the code in Nested Grid post i have tagged you so that you can go through unable to catch this point could you please explain?
MarkBoots
MarkBoots7mo ago
<div>hello</div>
<div style="display: contents">
<div>world</div>
</div>
<div>hello</div>
<div style="display: contents">
<div>world</div>
</div>
here the second div will only show the contents, not the div itself. so hello and world are threated as direct siblings of eachother
<div>hello</div>
<div>world</div>
<div>hello</div>
<div>world</div>
ProdJuan
ProdJuan7mo ago
cool, so you get the benefit of the group but w/o the structure insertion. neat!
MarkBoots
MarkBoots7mo ago
indeed it will show up in the html ofcourse, but it's not threated as such so in media queries you can change it if you need
Vandana
VandanaOP7mo ago
Great explaination!! Got it Thanks @MarkBoots @ProdJuan things are working as expected due to display:contents.Took 15 days to figure it out One more doubt. should the media queries min-width or max-width be in px or rem ?
MarkBoots
MarkBoots7mo ago
probably you would like to use px. screenwidths/monitor sizes are fixed while rem can be a user specified value
Vandana
VandanaOP7mo ago
Ya but then lot many posts do recommend to use rem only
MarkBoots
MarkBoots7mo ago
for typography yes. but a 1920 screen will be that, won't be changed by font size
Vandana
VandanaOP7mo ago
The Surprising Truth About Pixels and Accessibility
“Should I use pixels or rems?”. In this comprehensive blog post, we'll answer this question once and for all. You'll learn about the accessibility implications, and how to determine the best unit to use in any scenario.
Vandana
VandanaOP7mo ago
Go through the media queries section in this post
MarkBoots
MarkBoots7mo ago
yea, there are pro's and cons to this. it depends on the project i guess
Vandana
VandanaOP7mo ago
What do you suggest ?
MarkBoots
MarkBoots7mo ago
if it is a one column layout .no side bars or such (those can vary in width due to rem font-size), I think px is okay. but that's personal pref
Vandana
VandanaOP7mo ago
OK thanks for the help and information! @MarkBoots please review the code for the deployed link https://assortedgridrwd.netlify.app and let me know your feedback on this.Would be a great help!
Vandana
VandanaOP7mo ago
Stephen Lee
CodePen
Assorted cards & images (CSS Grid + BEM)
A card layout with various sizes, containing images and/or text. Using BEM to try to keep the code organized (and to help keep the design consistent)....
Want results from more Discord servers?
Add your server