Question

I'm trying to attempt the following. I have a div containing a box with a large border stroke. Here's the code I have been playing with.

.insta{
  background:#000;
  width:820px;
  height:300px;
  margin-left: auto;
  margin-right: auto;
}
.inner-line{
border:10px solid #fff;
width:88%;
height:300px;
position:relative;
right:20;
left:20;
top:20;
bottom:20;
}

<div class="insta"><div class="inner-line"></div></div>

And I get this result,

enter image description here

I'm trying to get to this as the final result,

enter image description here

I know of the box methods CSS provides, but don't know if I can achieve this using that. Any ideas or thoughts?

Was it helpful?

Solution

You can use a combination of box-shadow that isn't using a spread or blur and border:

CSS

    border: 10px solid white;
    -webkit-box-shadow: 0px 0px 0px 10px rgba(0,0,0,1);
    -moz-box-shadow: 0px 0px 0px 10px rgba(0,0,0,1);
    box-shadow: 0px 0px 0px 10px rgba(0,0,0,1);

JSfiddle

OTHER TIPS

Maybe border type "ridge" is enough...

http://jsfiddle.net/67U9z/1/

.inner-line{
    border:3px ridge white;
    ...

I know this question is very old, but you can use outline offset: http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_outline-offset

Just change the offset to a negative in order to get it inside the container:

outline-offset: -15px;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top