I can do
div:after {
content: \"hello\"
}
But can I have the hello text with a title so that when I hover it with the mouse
You don't need a pseudo-element for that:
p {
background:lightblue;
padding:15px;
margin:15px;
}
Some Text
However, if you need to use a pseudo element
p {
background:lightblue;
padding:15px;
margin:15px;
position: relative;
}
p:hover:after {
position: absolute;
content:attr(data-title);
left:0;
top:0;
width:200px;
height:1.25rem;
background-color: blue;
color:white;
}
Some Text