Languages

CSS flex box conditional wrapping problem

4 points
Asked by:
Creg
9600

I am doing currently comment system for my web page. I have got some problem with my layout.

I whould like to achive folowing effect only with css:

 

CSS - conditional wrapping problem

 

  • When comment is longer than available horizontal space i whould like to put External link to new line - first comment.
  • When comment is short just keel External link in same line - second comment.

Is it possible to do it only using css?

This is my template:

 

1 answer
1 points
Answered by:
Root-ssh
178430

Try to use:

  • flex-wrap: wrap; for .comment element
  • flex: auto; for .text element
  • flex: auto; for .link element

 Example solution below:

 

0 commentsAdd comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join