child escaping parent on float: right;

if i remove the float:right;, the text says inside the header, but when i add a float right, it decides to leave. any help on making this stay inside the header and float right?
26 Replies
Jochem
Jochem•2y ago
probably shouldn't be using float. it pulls elements out of the flow and you end up with issues like what you're describing
Gray
Gray•2y ago
what should i use instead?
Jochem
Jochem•2y ago
flex is usually a good alternative
Gray
Gray•2y ago
what would i use for the flex tho like flex-right? but that doesnt exist
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Gray
Gray•2y ago
its just going to be a logo and that button that works! thank you i didnt realise there was a flex end
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Gray
Gray•2y ago
yes
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Gray
Gray•2y ago
how exactly?
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Gray
Gray•2y ago
hmm
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Jochem
Jochem•2y ago
you change justify-content: flex-end; to justify-content: space-between;
Gray
Gray•2y ago
ok
Jochem
Jochem•2y ago
there's other options too if you have more than just a logo, but I'd suggest asking about that in a fresh question if you get to it, and adding a codepen 🙂
Gray
Gray•2y ago
well my logo insnt resizing so ill fix that rq forgot to add img
Gray
Gray•2y ago
well that doesnt seem to work
Gray
Gray•2y ago
they are just stacked
Jochem
Jochem•2y ago
display flex goes on the parent, it doesn't make any sense on an img tag
Gray
Gray•2y ago
\
Jochem
Jochem•2y ago
maybe check out https://flexboxfroggy.com/ before just adding a ton of display: flexes everywhere
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Jochem
Jochem•2y ago
Kevin has a bunch of videos on it too, and an entire (free) course called Conquering Responsive Layouts https://courses.kevinpowell.co/conquering-responsive-layouts
Kevin Powell
Conquering Responsive Layouts
Are you ready to take the challenge and finally figure out responsive layouts?  Click the button below and jump in!