Share Posted August 19, 2022 hello, i have a black div that contain a swap text it work so well, but i want to the width of black div change when a text swap, thanks See the Pen KKoJXWM by N-Nwekar20 (@N-Nwekar20) on CodePen Link to comment Share on other sites More sharing options...
Solution Solution Share Posted August 20, 2022 Hey there! Well, the container doesn't have any idea of how wide the word is at the moment as the words are out of the layout flow. The easiest way to do this would probably be to manually set up a timeline and adjust the width of the container yourself based on the word. You could also do something more dynamic by measuring the width of the incoming word and then setting the width of the container. 1 Link to comment Share on other sites More sharing options...
Author Share Posted August 20, 2022 hey Thanks for replying, could you show me something to figure out how to do it Link to comment Share on other sites More sharing options...
Share Posted August 20, 2022 Which option do you think you'd like to go for and what are you struggling to figure out from the explanation? Link to comment Share on other sites More sharing options...
Author Share Posted August 20, 2022 i solved my problem with the first one thank you so much. 1 Link to comment Share on other sites More sharing options...
Share Posted August 20, 2022 Glad to hear! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now