Answer the question
In order to leave comments, you need to log in
How to make a border on top of neighboring elements?
The task is the following: there is a colored block. When you hover over it, its border expands and should go on top of neighboring elements. My implementation . The bottom line is that on hover, the width of the border increases and the margin decreases proportionally.
.col-bor {
background-clip: content-box;
-moz-background-clip: content;
-webkit-background-clip: content;
box-sizing: content-box;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
border-width: 0px;
border-style: solid;
transition-property: border-width, margin;
transition-duration: .3s;
-webkit-transition-property: border-width, margin;
-webkit-transition-duration: .3s;
}
.col-bor:hover {
border-width: 10px;
margin: -10px;
z-index: 5;
}
Answer the question
In order to leave comments, you need to log in
Instead of border write outline
I am 99% sure that this will help you.
jsfiddle.net/iiil/x3Am6
here's an idea. And in your example it will definitely twitch. Don't even try to change it.
In the previous answer, because of the margin articles, I did not notice that the frame does not overlap adjacent elements.
This is how it should be jsfiddle.net/iiil/x3Am6/1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question