Ask coding questions

← Back to all posts
How to make a box that appears over text in HTML/CSS
bennyrobert (45)

Hello. So, my website has a list of pages, but the pages can only support one line of text. If we go over that, then it messes up the page. One fix is, if the title is too long, then a box appears (like on YouTube) with the full title, such as below:

Only problem is, I don't know how I could go about doing this. Can someone help me?

Extra info: I don't need it so that it checks if the title is too long. I'll check myself, and if it is, I'll add the script.

Answered by notGilbert (121) [earned 5 cycles]
View Answer
notGilbert (121)

Use the HTML title attribute

<h1 title="you'll see this if you hover over it for long enough">This is some text blah blah</h1>