D
D
Den Savi2016-04-07 12:22:27
css
Den Savi, 2016-04-07 12:22:27

How to make a more detailed button that will expand the block?

The task is this: There is a block, you need to make it fit, for example, 4 lines. If there are more lines, it is necessary that the "more details" button appear, when pressed, the rest of the text appears. The text should go out, and the button changed the text, for example, to "hide". How to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Yamshik, 2016-04-07
@den_savi

For the text, set the desired height max-height , hide the excess - set overflow: hidden. When the button is pressed, set the max-height of the text to 999px (for example). This can be done using JS, for example, or purely on css using the input checkbox.
PS Well, for beauty, add a transition.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question