-1
body{
font-size: 24px;
display: flex;
justify-content: center;
margin: 75px 0;
}
.button{
padding: 1px 3px 2px;
font-weight: bold;
color: #ffffff;
text-transform: uppercase;
white-space: nowrap;
background-color: #bfbfbf;
border-radius: 3px;
text-decoration: none;
max-height: 24px;
}
.button:hover{
display:"none";
}
.button:hover:after{
content: 'my second box';
cursor: crosshair;
background-color: #46a546;
\t \t
}
<body>
<div class="button">my first box</div>
</body>
下面是一些jsfiddle鼓搗。我覺得我已經嘗試過所有的組合來完成這項工作!關於我需要對這段代碼進行的更改類型的任何想法,以便阻止原始框從一側移到另一側?
爲什麼不試試'顯示:無;',而不是'顯示: 「無」' ? –
刪除引號是一個好的開始,但是我也看到':hover:after'工作方式的問題,不確定它是否被用於這種方式。 – akousmata
刪除引號,您將在懸停時看到閃爍。看到這個答案http://stackoverflow.com/questions/5844622/how-to-make-a-div-disappear-on-hover-without-it-flickering-when-the-mouse-moves爲什麼。 – akousmata