div question

can someone explain me how to do like that? i just dont understand how i move this div text with white background to the right side. can somebody explain me? You dont need to write me solution, just explain the princple. "img attached how it should look" ---------------- thats how my code looks rn .vrsection{ width: 100%; min-height: 100vh; display: flex; align-items: center;


padding-left: 100px;
} .interaction_text h2{ font-size: 3rem; line-height: 3rem; text-transform: uppercase; font-family: "Alata"; font-weight: 300; letter-spacing: 0.3rem; color: hsl(0, 0%, 0%);
} .interaction_text{
text-wrap: wrap;
background-color: white; width: 50%;

}
No description
33 Replies
dys šŸ™
dys šŸ™ā€¢3d ago
If you do a Codepen, someone may tweak it for you.
Helgi
HelgiOPā€¢3d ago
okay so i figured out that i need to use relative and absolute positions. BUT..
snxxwyy
snxxwyyā€¢3d ago
grid would be the best solution imo position absolute would be pretty unstable for this layout
Helgi
HelgiOPā€¢3d ago
how i can do it with grid
snxxwyy
snxxwyyā€¢3d ago
something like that then you can place the content in the corresponding rows and columns
snxxwyy
snxxwyyā€¢3d ago
No description
Helgi
HelgiOPā€¢3d ago
oh fuck indeed ill try
Jochem
Jochemā€¢3d ago
it'd be easier to help with a codepen, cause we don't have your html now... but you can use align- and justify- (either content on the parent, or self on the elements themselves) to shift the position of flex children too And honestly, position: absolute isn't a terrible option either, you just set bottom and right to 0 and set a max- and min-width on the wrapper so it'll move on smaller screens a little. You have to have a media query to stack these elements vertically on small screens anyway
Helgi
HelgiOPā€¢3d ago
fuck my life
No description
Helgi
HelgiOPā€¢3d ago
ive got another problem, its not responsive at all /css/ .vrsection{ width: 100%; min-height: 100vh; padding-left: 100px; display: flex; align-items: center; position: absolute;



} .vr_section_img{ min-width: 300px;

} .interaction_text{ text-wrap: wrap; background-color: white; max-width: 30%; display: flex; flex-direction: column; align-content: center; align-items: center; position: relative; top: 7rem; right: 6rem; padding: 40px;

} .interaction_text h2{ font-size: 2rem; line-height: 3rem; text-transform: uppercase; font-family: "Alata"; font-weight: 300; letter-spacing: 0.3rem; color: hsl(0, 0%, 0%);
} /html/ <nav> <div class="parent"> <div class="parent_photo"> <img src="attachment-dd-osama-photo.jpg" alt="" /> </div> <div class="child"> <h2>The leader in interactive VR</h2> <p> Founded in 2011, Loopstudios has been producing world-class virtual reality projects for some of the best companies around the globe. Our award-winning creations have transformed businesses through digital experiences that bind to their brand. </p> </div> </div> </nav> what i am doing wrong???
No description
dys šŸ™
dys šŸ™ā€¢3d ago
Again, for the, what, fourth time? in this conversation: Codepen!
Jochem
Jochemā€¢3d ago
The reason we recommend people add a codepen or similar live version of their code, is that it helps people help you. Right now, if I wanted to check your code, I'd have to set up a codepen myself, copy your code in, find a placeholder image, and then I don't even know for sure it went right and there's not some issue that's outside of the little snippets you shared here. If you set up a codepen (it's entirely free), then we know that the issue you're having is actually the one we're going to be seeing in our browser as well, and that means we can actually help you fix it you're also asking people to put in extra effort just to be able to put in more effort to help you, when you could be the one putting in a tiny bit of extra effort in asking your question to make it so much easier for others
dosalover47
dosalover47ā€¢2d ago
isnt using a negative margin an option too ?
clevermissfox
clevermissfoxā€¢2d ago
Not a proper one. Often creates more problems than it solves. We have better layout tools available now so there are better options than negative margins. Grid would be perfect and very simple for this layout
dosalover47
dosalover47ā€¢2d ago
can you like provide me a code snippet on how to do this with grid ? i hope its not much code
clevermissfox
clevermissfoxā€¢2d ago
Iā€™m on mobile at the moment but if you or OP set up a codepen with the elements to overlap , one of us can help you with the grid
dosalover47
dosalover47ā€¢2d ago
is this enough?
clevermissfox
clevermissfoxā€¢2d ago
@Chris Bolson has a great example ready to go that he was kind enough to allow me to share so I donā€™t have to deal with codepen x mobile šŸ˜† This is one of the ways you can accomplish the layout in question https://codepen.io/cbolson/pen/RNbKrPx
Chris Bolson
CodePen
[demo] Grid template-areas overlap (responsive)
Responsive overlapping grid areas....
clevermissfox
clevermissfoxā€¢2d ago
Try typing out the properties on your code pen (versus pasting) Muscle memory and repetition is how you learn Also turning on the grid visualizer in the dev tools (right click on the element -> inspect -> then thereā€™s a little tab that says ā€œgridā€, highlight/click on that) to see the grid visually
dosalover47
dosalover47ā€¢2d ago
i dont understand where the image-stop area is coming from
clevermissfox
clevermissfoxā€¢2d ago
Thatā€™s the name of the grid-area where the image should end. Itā€™s like grid-row-start: image; grid-row-end: image-stop;
dosalover47
dosalover47ā€¢2d ago
wait , since we have defined 2 rows , one name is for the start and one is for end ? right ?
clevermissfox
clevermissfoxā€¢2d ago
Thereā€™s three rows in the grid
dosalover47
dosalover47ā€¢2d ago
it says 2
clevermissfox
clevermissfoxā€¢2d ago
So thereā€™s a name for the start and a name for the end. Can if there were ten rows , there would be a grid -row-start value and a grid-row-end value
dosalover47
dosalover47ā€¢2d ago
grid-template-rows: 100px auto;
grid-template-rows: 100px auto;
clevermissfox
clevermissfoxā€¢2d ago
But there are three rows in the grid area ā€œImage image imageā€-row 1 ā€œImage-stop text .ā€ -row 2 ā€œ. Text . ā€œ -row 3 * the . Represent empty cells. And on your travels look up ā€œimplicitā€ and ā€œexplicitā€ rows. Iā€™ve hijacked this thread enoughšŸ˜† just saw red when I saw the ā€œnegative marginsā€ comment and typed faster than my logical brain could think
clevermissfox
clevermissfoxā€¢2d ago
If you donā€™t need overlapping content , you can use one name for the grid-row-start and for the grid-row-end but to use grid-template-areas and also have your content overlap, you need two different names. You can also use named grid-lines. Watching some kPow videos and this css tricks article are great resources
Chris House
CSS-Tricks
CSS Grid Layout Guide | CSS-Tricks
Our comprehensive guide to CSS grid, focusing on all the settings both for the grid parent container and the grid child elements.
clevermissfox
clevermissfoxā€¢2d ago
Also this playlist is a great introduction. https://youtube.com/playlist?list=PLu8EoSxDXHP5CIFvt9-ze3IngcdAc2xKG&si=xatFjMAEw75kbXz3 only a few things have changed since this was made
YouTube
CSS Grid
clevermissfox
clevermissfoxā€¢2d ago
YouTube
CSS Grid videos
The CSS Grid is here, and it's awesome. This playlist is a collection of all the videos I do where I use the CSS Grid, whether it's a tutorial specific to us...
dosalover47
dosalover47ā€¢2d ago
thank you . i will check out
Helgi
HelgiOPā€¢11h ago
thanks for help
Want results from more Discord servers?
Add your server