Hello & Thanks ,
In code below I do a ’ div:hover + p.borderShowTop{ ’
to show a ‘comment’ onhover .
Now I want to do a ’ border onhover ’
to show a ‘comment’ .
Plz, can someone show me how to set that up ?
…
<!DOCTYPE html>
<html>
<head>
<style>
p.borderShowTop
{
background-color: yellow;
padding: 20px;
display: none;
}
p.borderShowRight
{
background-color: yellow;
padding: 20px;
display: none;
}
div {
border-style: solid;
border-color: green red blue pink;
border-width: 12px 12px 1px 2px;
}
div:hover + p.borderShowTop{
display: block;
}
</style>
</head>
<body>
<br><br>
<div contenteditable="true">Hover over me! Contenteditable.</div>
<p class="borderShowTop">I will show on hover</p>
</body>
</html>
I want to create an onhover for the ‘top border’ ,
and a separate hover for the ‘right border’ .
‘top border’ message should say "Click Top-border & hold down left-mouse to Drag ‘div’ .
‘right border’ message should say “Click on Right-border to change DIV size” .
So the important issue here to to be able to ‘click on a border’ (not on the 'div ') , to trigger a response . Something like topBorder:onhover .
I am having trouble with ‘how to code that’ .
Thanks
Ah! I get it now. Thanks for the clarification. There is no way to make a border clickable. One approach you can use is to have four div elements, one for each edge that mimics a border. I can’t think of another way of making that work
The selector you have for the hover specifies that the p element is immediately adjacent to your div element. In your code now, you have the p element as a child of the div. This means you can do this instead:
div:hover p.borderShowTop {
display: block;
}
Also, you don’t need to use a separate script element for each function you are adding. You can combine all of your JavaScript code inside just a single script element
Creating engaging and entertaining content for designers and developers since 1998.