1
我已經看到了我需要的東西的類型,在這個link。頁面加載時畫一個邊框?
我想要第一個繪製頁面加載時,有沒有什麼辦法可以做到這一點?
我試着搞亂了代碼,但沒有結果,當我將鼠標懸停在div上而不是在頁面加載時繪製它時,邊框仍然會出現。
&::before,
&::after {
// Set border to invisible, so we don't see a 4px border on a 0x0 element before the transition starts
border: 2px solid transparent;
width: 0;
height: 0;
}
// This covers the top & right borders (expands right, then down)
&::before {
top: 0;
left: 0;
}
// And this the bottom & left borders (expands left, then up)
&::after {
bottom: 0;
right: 0;
}
&:hover {
color: $cyan;
}
// Hover styles
&:hover::before,
&:hover::after {
width: 100%;
height: 100%;
}
&:hover::before {
border-top-color: $cyan; // Make borders visible
border-right-color: $cyan;
transition:
width 0.25s ease-out, // Width expands first
height 0.25s ease-out 0.25s; // And then height
}
&:hover::after {
border-bottom-color: $cyan; // Make borders visible
border-left-color: $cyan;
transition:
border-color 0s ease-out 0.5s, // Wait for ::before to finish before showing border
width 0.25s ease-out 0.5s, // And then exanding width
height 0.25s ease-out 0.75s; // And finally height
}
}
請也分享你的HTML代碼,以便我們更好地理解你的問題。 –
你有沒有想過像這個例子http://jsfiddle.net/ueu64hps/1/ –
@UdhayTitus不是真的,我想畫線不填滿邊框。 –