Code css hover image border cho website wordpress
Tạo 1 block HTML và chèn code HTML như bên dưới
<div class="nhatdev"> <a href=""><img src="https://theme.hstatic.net/1000340279/1000431896/14/large_banner_2_image.jpg?v=7"> <span class="effect-line"></span> </a> </div>
Sau đó chèn CSS vào file style.css
a{ width:100%; float:left; position: relative; z-index: 1; text-align: center; } a img{ display: block; max-width: 100%; height: auto; } a img:after{ content: ''; position: absolute; z-index: 1; width: 100%; height: 0; top: 0; left: 0; -moz-transition: all 500ms ease; -webkit-transition: all 500ms ease; -o-transition: all 500ms ease; transition: all 500ms ease; -moz-backface-visibility: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; background: rgba(0, 0, 0, 0.18); } .effect-line{ position: absolute; content: ""; top: 0; right: 0; left: 0; bottom: 0; z-index: 1; } .effect-line:before { z-index: 1; content: ""; position: absolute; left: 10px; right: 10px; top: 10px; bottom: 10px; border-top: 2px solid #fff; border-bottom: 2px solid #fff; transform: scale(0, 1); -moz-transform: scale(0, 1); -webkit-transform: scale(0, 1); -ms-transform: scale(0, 1); transition: all 0.4s ease-in-out 0s; -moz-transition: all 0.4s ease-in-out 0s; -webkit-transition: all 0.4s ease-in-out 0s; } .effect-line:after { z-index: 1; content: ""; position: absolute; left: 10px; right: 10px; top: 10px; bottom: 10px; border-left: 2px solid #fff; border-right: 2px solid #fff; transform: scale(1, 0); -moz-transform: scale(1, 0); -webkit-transform: scale(1, 0); -ms-transform: scale(0, 1); transition: all 0.4s ease-in-out 0s; -moz-transition: all 0.4s ease-in-out 0s; -webkit-transition: all 0.4s ease-in-out 0s; } a:hover .effect-line:before{ transform:scale(1,1); } a:hover .effect-line:after{ transform:scale(1,1); }