开发者

How to replace text without making following content "jump"?

I have web page and in the middle of it is a paragraph of text. I want to replace the text when the user hovers the cursor over an image, but I don't want the page to seem to jump around and there are several possible texts - of differing lengths.

I guess that that means that I need to reserve a fixed size are for the text, but which?

There are not so many texts, just a handful, so I don't need to write any code to determine the size of the largest, I can just do it manually. But what's a good container for the text to that replacing it开发者_Python百科 does not make the page contents after either jump up or down owing to difference of length of old & new text?


How about putting a scroller bar if the text is longer and leave empty space if it's shorter?


this paragraph could be in div with overflow: hidden; attribute and set width and height


Instead of replacing the text, why not have an overlay div?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜