Your Opinion

Hi guys I was wondering how do make these two divs responsive on ipad/wide screens as they are moved using position relative everyones opinion matters so drop it
No description
62 Replies
snxxwyy
snxxwyy4mo ago
If it was me I’d use grid for that layout, then it becomes responsive
Code-S ♛
Code-S ♛OP4mo ago
Hmmmm... didn't know i could do that But ill watch a YouTube video on it
snxxwyy
snxxwyy4mo ago
yeah you can, it's pretty neat, i recommend becoming really familiar with grid, i'd probably do something like this
snxxwyy
snxxwyy4mo ago
No description
Code-S ♛
Code-S ♛OP4mo ago
it is too complicted for me the content just doesnt overlap idk why? watched a video of kevin but he used 1/2 values and idk those, but i did come across a video in which a guy used flexbox and just gave -margin to overlap
snxxwyy
snxxwyy4mo ago
you have to specify that you want the divs to overlap otherwise they don't, something like this
.grid {
display: grid;
grid-template-columns: 3fr 1fr 2fr;
grid-template-rows: 1fr auto;
}

.image {
grid-column: 1 / 3;
grid-row: 1 / 3;
}

.text {
grid-column: 2 / 4;
grid-row: 2 / 3;
}
.grid {
display: grid;
grid-template-columns: 3fr 1fr 2fr;
grid-template-rows: 1fr auto;
}

.image {
grid-column: 1 / 3;
grid-row: 1 / 3;
}

.text {
grid-column: 2 / 4;
grid-row: 2 / 3;
}
vince
vince4mo ago
You can also use grid-template-areas too
Code-S ♛
Code-S ♛OP4mo ago
No description
Code-S ♛
Code-S ♛OP4mo ago
No description
Code-S ♛
Code-S ♛OP4mo ago
i am just too much of a beginner ig its just so confusing like i did play around and got the box on the image but it just wont go to the bottom toooo hard for me IT HAS BEEN OFFICIALLY 2 HOURS i was trynna figure this grid thing 🥱 going to sleep
snxxwyy
snxxwyy4mo ago
you don't have 3 columns in your code, you have 1fr 2fr. the third column is essential for the overlap, you need to put grid-template-columns: 3fr 1fr 2fr;
Code-S ♛
Code-S ♛OP4mo ago
My mom will beat me if I turned the PC on now
vince
vince4mo ago
Man what are you doing trying to learn coding then 🤣 enjoy your youth Plenty of time to stress about this stuff in a few years or whenever Take advantage of your youth 🙂 and chill
Code-S ♛
Code-S ♛OP4mo ago
you see my grades aint looking so good so i have no option 😔 trying rn i am tired BRUH it just doesnt overlap the image man idk why i am moving to the next section for now
clevermissfox
clevermissfox4mo ago
You can't overlap cells with grid-template-areas unfortunately, but if you just want access to the grid-area name you can write your template with named lines
grid-template-columns: [img-start] 1fr [text-start] 5rem [img-end] 1fr [text-end];
& .my-img {grid-area: img;}
& .my-text {grid-area: text;}
grid-template-columns: [img-start] 1fr [text-start] 5rem [img-end] 1fr [text-end];
& .my-img {grid-area: img;}
& .my-text {grid-area: text;}
And you can also specify different names for columns vs rows if you need to then assign it to the relevant grid-column or grid-row property on the child . I love area names so anything I have to change in a query is all changed on the parent. I don't have to revert all the children's fixed cells grid-column: 2/6; grid-row: 1/3 on every child
snxxwyy
snxxwyy4mo ago
it should look something like this, here's an overlap example: https://codepen.io/deerCabin/pen/poXNgYa. Then you collapse it at smaller screen sizes.
Code-S ♛
Code-S ♛OP4mo ago
i will say it now you guys are just too professional half of the things you guys say i just cant seem to understand 😔 i havent figured this out yet ill do that after i make my sites mobile version
snxxwyy
snxxwyy4mo ago
What about it are you still not sure about?
Code-S ♛
Code-S ♛OP4mo ago
I get lost, sometimes i cant find a youtube video about the problems i face, it sucks. The person who got me in this field is dissapointed in me. It has been almost 2 months and i dont even know the basics and the worst part is that you guys try your best to help me but i am the one not understanding so i just dont ask further questions bc the problem is me i would share the code pen with you but the images aree not showing up and most of itis made in images
snxxwyy
snxxwyy4mo ago
It takes a while to understand everything, you just have to keep at it. Work on small projects, and ask questions about anything you’re curious about even if it’s small, try to understand everything in depth as possible. There aren’t videos on everything that could go wrong unfortunately
Code-S ♛
Code-S ♛OP4mo ago
is it just me or when i apply body width to 100vw a horizontal scroll bar appears like in this pic the black box
No description
Code-S ♛
Code-S ♛OP4mo ago
or is it my monitors problem?
snxxwyy
snxxwyy4mo ago
When you give a div 100vw there’s always a bit of horizontal scrolling I believe, you’d have to use overflow-x: hidden.
Code-S ♛
Code-S ♛OP4mo ago
gave it overflow-x: hidden; didnt work
snxxwyy
snxxwyy4mo ago
Give the body it But you don’t need to give the body a width of 100vw if that’s what you meant in your original message, that’s virtually what it already is
Code-S ♛
Code-S ♛OP4mo ago
i made it in footer its out of the body
snxxwyy
snxxwyy4mo ago
You don’t need it for that either, the footer tag is the full width of its container, it doesn’t need to be 100vw
vince
vince4mo ago
Feeling sorry for yourself isn't going to do anything. You can figure this out it just takes a while and a lot of practice & effort. My first couple years working with css produced a lot of crap code. Also you shouldn't be putting width: 100vw on your container, and the likely reason why it shows the scrollbar is because you have a border around the container and / or you might not be using box-sizing: border-box;
Code-S ♛
Code-S ♛OP4mo ago
i gave the body the overflow-x:hidden; and it worked but dont understand it becasue they both are compltely different sections overdlow worked on body
vince
vince4mo ago
Take off width: 100vw and you won't need overflow-x: hidden
snxxwyy
snxxwyy4mo ago
^^
vince
vince4mo ago
Less is more in css Each property you give an element / class / etc should be intentional Take off width: 100vw and see what happens Does it still function the same?
Code-S ♛
Code-S ♛OP4mo ago
no it shrinks
vince
vince4mo ago
Do you have a display: flex on your body, or a parent element?
Code-S ♛
Code-S ♛OP4mo ago
yes on the body
vince
vince4mo ago
That that off
Code-S ♛
Code-S ♛OP4mo ago
if i do my wholde page like gets messed up and not responsive i made the whole code according to that
vince
vince4mo ago
That's because there's probably a lot of beginner 'hacks' in your code
Code-S ♛
Code-S ♛OP4mo ago
faults you can say
vince
vince4mo ago
You shouldn't use display: flex on the body unless there's a real reason; why did you add it in the first place? Yea
Code-S ♛
Code-S ♛OP4mo ago
going through the crappy era of me
vince
vince4mo ago
Everyone goes through it
Code-S ♛
Code-S ♛OP4mo ago
idk i just get it done i dont know anything about SEO best practices etc
vince
vince4mo ago
This is css not seo - did you go through the beginner courses from Kevin Powell? Like Conquering Responsive Layouts (CRL)?
Code-S ♛
Code-S ♛OP4mo ago
uhh No
vince
vince4mo ago
I heard that's a good start, I would go through that Learn the right way in the beginning and you can skip a lot of these beginner mistakes
Code-S ♛
Code-S ♛OP4mo ago
sure i will
snxxwyy
snxxwyy4mo ago
even i still don't know things, the more you practice the more you understand
Code-S ♛
Code-S ♛OP4mo ago
thats what someone said to me so i got straight to making projects after the basics of html and css
snxxwyy
snxxwyy4mo ago
from the looks of the projects you're doing, they may be too complex for your skillset at the moment. I know front end mentor suggests getting feedback before moving to the next project to prevent those beginner mistakes as vince said, try building smaller things
Code-S ♛
Code-S ♛OP4mo ago
newbie level?
snxxwyy
snxxwyy4mo ago
yeah
Code-S ♛
Code-S ♛OP4mo ago
from now on i move to newbie
snxxwyy
snxxwyy4mo ago
that's what that level system means, you're supposed to make your way gradually from newbie to guru
Code-S ♛
Code-S ♛OP4mo ago
this is the last project for me on this level but i gotta complete what i started so ill finish this one real quick and select a newbie one
snxxwyy
snxxwyy4mo ago
i'd try give that a go and if it doesn't go to plan don't throw a load of random fixes in and call it a day, move to newbie then come back and you'll understand why you were having the problems you were and can fix them a more efficient way
Code-S ♛
Code-S ♛OP4mo ago
ill give it a go if it does bother me a lil bit now
snxxwyy
snxxwyy4mo ago
here's an idea of what you'd need to use for that project
snxxwyy
snxxwyy4mo ago
No description
Code-S ♛
Code-S ♛OP4mo ago
thank you!
snxxwyy
snxxwyy4mo ago
You’re welcome
Code-S ♛
Code-S ♛OP4mo ago
🫂
Want results from more Discord servers?
Add your server