Inner border over images with CSS?

前端 未结 5 1821
滥情空心
滥情空心 2020-12-02 16:47

I would like to add a white border over all my images in my content div using css. Images in the header and footer div areas should not be affected. how do I achieve this?

5条回答
  •  攒了一身酷
    2020-12-02 17:31

    You can do something like this DEMO

    HTMl

    CSS

    .imgborder {
        width: 300px;
        height: 300px;
        position: relative;
        background: url(http://placekitten.com/300/300) no-repeat;
    }
    .in-imgborder {
        width: 290px;
        height: 290px;
        position: absolute;
        top: 4px;
        left: 4px;
        border: 1px solid red;
    }
    

提交回复
热议问题