Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

HTML and CSS for gallery image border

I want create this type gallery. I have multiple images in it. So when I hover on it then images should changes automatically.
Now I’m facing one issue i.e. How to add two borders like this using css or any other style-sheet.

image

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can add some box-shadow together. The first one is gray. The second one is white as a border with a one-pixel movement than the previous.

body{
background:#efefef;
}
.wrapper {
  position: relative;
  padding:10px;
}

.image {
  width: 100px;
  height: 100px;
  background: #000;
  border: 1px solid #FFF;
  position: absolute;
  box-shadow: 5px -5px 0 gray,6px -6px 0 white,11px -11px 0 lightgray,12px -12px 0 white;
}
<div class="wrapper">
  <div class="image"></div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading