Running into an issue when viewport reaches a certain threshold

Ive been doing the CRL course and I'm trying a challenge but when the viewport gets below a certain width everything just goes towards the left and I'm left with whitespace on the right, the more smaller the viewport gets the more to the left everything goes, if that makes sense. I can't remember what the solution to this was but I'd appreciate any help!
No description
14 Replies
MarkBoots
MarkBoots13mo ago
that is because the words itself won't break. you see the word "responsive" in this case you could play with font-size: clamp() to adjust the size to the available size An other option is to use word-break: break-all; to force the words to wrap if there is not enough space
unluqy
unluqyOP13mo ago
oh so thats only happening because of my text being too big for the width? i saw kevin do something else too it was like uh settings headers to a vw and paragraphs to a vh, would that also help fix the issue?
MarkBoots
MarkBoots13mo ago
i think it is, without seeing the actual thing i can only guess
unluqy
unluqyOP13mo ago
uhh i could send the code if u want itd be in text form though
MarkBoots
MarkBoots13mo ago
look at #how-to-ask-good-questions how you can share it
unluqy
unluqyOP13mo ago
oh okay! https://codepen.io/Troll-Rogers/pen/wvNqKYL wait here i think this should owrk lmk if it doesnt
MarkBoots
MarkBoots13mo ago
you could start with removing the width of your hero-text. max-width is enough and then use clamp for your font-size
unluqy
unluqyOP13mo ago
ooh okay thanks ill try ! so the issue is just with fonts right? is everything else fine?
MarkBoots
MarkBoots13mo ago
yea, that should be enough
unluqy
unluqyOP13mo ago
wait so for the clamp, i was testing it whats the middle value since the first value is the minimum, the last one is the maximum i dont understadn what the middle one does haha, if u could explain id appreciate it alot @MarkBoots (sorry to ping i couldnt find anyhting i understand online though) ^
Heitor
Heitor13mo ago
The middle value for clamp is the preferred value, its a expression, that will be the used value as long as it is between the minimum and the maximum. for example: font-size: clamp(2rem, 5vw + 1rem, 10rem); so as long as the result of the 5vw + 1rem is between the values of 2rem and 10rem it will be the used value.
unluqy
unluqyOP13mo ago
ohh i see, it cant get any bigger than 10 rem or any smaller than 2rem right also ive seen alot of people do what you just did, e.g 2vw + 1 rem or 3vw + 1 rem, whats the use of this in comparison or just writing 2vw or 3vw
Heitor
Heitor13mo ago
yeah that is right basically that + rem it's just so if someone is wants to zoom in the browser it makes the zoom works in the font too if it is in the middle value, it is not necessary but its good to have it
unluqy
unluqyOP13mo ago
ohh okay thanks alot
Want results from more Discord servers?
Add your server